From 104692129fd34a52dd967095f57371d1781c9172 Mon Sep 17 00:00:00 2001 From: Tom Willemsen Date: Wed, 30 Jun 2010 21:21:34 +0200 Subject: made install.sh executable added .Xdefaults --- .Xdefaults | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .Xdefaults (limited to '.Xdefaults') diff --git a/.Xdefaults b/.Xdefaults new file mode 100644 index 0000000..9bc9e1b --- /dev/null +++ b/.Xdefaults @@ -0,0 +1,44 @@ +! General +urxvt*loginShell: true +urxvt*scrollBar: false +urxvt*secondaryScroll: true +urxvt*saveLines: 65535 +urxvt*cursorBlink: false +urxvt*urgentOnBell: true + +! Extensions +urxvt*perl-lib: /usr/lib/urxvt/perl/ +urxvt*perl-ext-common: default,matcher,searchable-scrollback +urxvt*urlLauncher: chromium-browser +urxvt*matcher.button: 1 +! - catch ugly URLs +!urxvt.cutchars: `()'*<>[]{|}" + +! Appearance +! - use a bitmap font +urxvt*font: -xos4-terminus-medium-*-*-*-14-*-*-*-*-*-*-* +urxvt*boldFont: -xos4-terminux-bold-*-*-*-14-*-*-*-*-*-*-* +! - cursor +urxvt*cursorColor: #DCDCCC +! - pseudo transparency +urxvt*shading: 20 +urxvt*transparent: true +! - color scheme +urxvt.background: #000000 +urxvt.foreground: #EBEBFF +urxvt*color0: #000000 ! black +urxvt*color1: #E01010 ! red +urxvt*color2: #00AA00 ! green +urxvt*color3: #FFFF00 ! yellow +urxvt*color4: #112037 ! blue +urxvt*color5: #A020F0 ! purple +urxvt*color6: #5B5BC7 ! cyan +urxvt*color7: #FEFEFE ! white +urxvt*color8: #6A6A6A ! bright-black +urxvt*color9: #FF5555 ! bright-red +urxvt*color10: #90EE90 ! bright-green +urxvt*color11: #FFFF2F ! bright-yellow +urxvt*color12: #5B5BC7 ! bright-blue +urxvt*color13: #E628BA ! bright-purple +urxvt*color14: #7D7DFB ! bright-cyan +urxvt*color15: #FFFFFF ! bright-white \ No newline at end of file -- cgit v1.2.3-54-g00ecf From c38f147ead1d57f48a75df8653ed3ed1c12eebd3 Mon Sep 17 00:00:00 2001 From: ryuslash Date: Thu, 1 Jul 2010 22:28:59 +0200 Subject: Added xmodmap Added rainbow.el to emacs Showing some extra messages with install.bat and install.sh Added some elisp to check which distro I'm on at that moment, though I don't yet use it --- .Xdefaults | 18 +---- .Xmodmap | 1 + .emacs.d/include.el | 2 + .emacs.d/ports.el | 29 +++++++ .emacs.d/rainbow-mode.el | 207 +++++++++++++++++++++++++++++++++++++++++++++++ install.bat | 2 + install.sh | 16 +++- 7 files changed, 256 insertions(+), 19 deletions(-) create mode 100644 .Xmodmap create mode 100644 .emacs.d/ports.el create mode 100644 .emacs.d/rainbow-mode.el (limited to '.Xdefaults') diff --git a/.Xdefaults b/.Xdefaults index 9bc9e1b..e1c317c 100644 --- a/.Xdefaults +++ b/.Xdefaults @@ -25,20 +25,4 @@ urxvt*shading: 20 urxvt*transparent: true ! - color scheme urxvt.background: #000000 -urxvt.foreground: #EBEBFF -urxvt*color0: #000000 ! black -urxvt*color1: #E01010 ! red -urxvt*color2: #00AA00 ! green -urxvt*color3: #FFFF00 ! yellow -urxvt*color4: #112037 ! blue -urxvt*color5: #A020F0 ! purple -urxvt*color6: #5B5BC7 ! cyan -urxvt*color7: #FEFEFE ! white -urxvt*color8: #6A6A6A ! bright-black -urxvt*color9: #FF5555 ! bright-red -urxvt*color10: #90EE90 ! bright-green -urxvt*color11: #FFFF2F ! bright-yellow -urxvt*color12: #5B5BC7 ! bright-blue -urxvt*color13: #E628BA ! bright-purple -urxvt*color14: #7D7DFB ! bright-cyan -urxvt*color15: #FFFFFF ! bright-white \ No newline at end of file +urxvt.foreground: #EBEBFF \ No newline at end of file diff --git a/.Xmodmap b/.Xmodmap new file mode 100644 index 0000000..9109241 --- /dev/null +++ b/.Xmodmap @@ -0,0 +1 @@ +pointer = 3 2 1 \ No newline at end of file diff --git a/.emacs.d/include.el b/.emacs.d/include.el index 9000147..35c273a 100644 --- a/.emacs.d/include.el +++ b/.emacs.d/include.el @@ -11,6 +11,8 @@ "~/.emacs.d/sqlplus.el" "A Major mode for communicating with Oracle" t) (autoload 'batch-mode "~/.emacs.d/batch-mode.el" "A Major mode for editing Batch files" t) +(autoload 'rainbow-mode + "~/.emacs.d/rainbow-mode.el" "A Minor mode for showing colors inline" t) (load-file "~/.emacs.d/auto-complete-config.el") (require 'auto-complete-config) \ No newline at end of file diff --git a/.emacs.d/ports.el b/.emacs.d/ports.el new file mode 100644 index 0000000..eec3854 --- /dev/null +++ b/.emacs.d/ports.el @@ -0,0 +1,29 @@ +;; function copied from dim-ports.al by Dimitri Fontaine +;; http://git.naquadah.org/?p=~dim/emacs.d.git;a=summary +(defun lsb-release (&optional property) + "Parse lsb-release output and return an alist, or the value for the given property" + (when (file-executable-p "/usr/bin/lsb_release") + (let* ((lsbr (shell-command-to-string "/usr/bin/lsb_release -a 2>/dev/null")) + (props (split-string lsbr "[:\n]" t)) + (kv)) + (while (>= (length props) 2) + ;; Don't keep extra spaces. This way seems like the easy one in elisp. + (let ((key (mapconcat 'identity (split-string (car props)) " ")) + (val (mapconcat 'identity (split-string (cadr props)) " "))) + (setq kv (add-to-list 'kv (cons key val))) + (setq props (cddr props)))) + (if property + (cdr (assoc property (lsb-release))) + kv)))) + +;; function copied from dim-ports.al by Dimitri Fontaine +;; http://git.naquadah.org/?p=~dim/emacs.d.git;a=summary +(defmacro when-running-ubuntu (&rest body) + "eval body only when running under Ubuntu" + (when (equal (lsb-release "Distributor ID") "Ubuntu") ,@body)) + +;; function adapted from dim-ports.al by Dimitri Fontaine +;; http://git.naquadah.org/?p=~dim/emacs.d.git;a=summary +(defmacro when-running-fedora (&rest body) + "eval body only when running under Fedora" + (when (equal (lsb-release "Distributor ID") "Fedora") ,@body)) \ No newline at end of file diff --git a/.emacs.d/rainbow-mode.el b/.emacs.d/rainbow-mode.el new file mode 100644 index 0000000..8207abc --- /dev/null +++ b/.emacs.d/rainbow-mode.el @@ -0,0 +1,207 @@ +;;; rainbow-mode.el --- prints color strings with colored background + +;; Copyright (C) 2010 Julien Danjou + +;; Author: Julien Danjou +;; Keywords: strings, faces + +;; This file is NOT part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see . + +;;; Commentary: +;; This minor mode will add background to strings that matches color names. +;; i.e. +;; #0000ff +;; Will be printed in white with a blue background. +;; + +;;; Code: + +(eval-when-compile + (require 'cl)) + +(require 'regexp-opt) +(require 'faces) + +(defgroup rainbow nil + "Show color strings with a background color." + :tag "Rainbow" + :group 'help) + +;; Hexadecimal colors +(defvar rainbow-hexadecimal-colors-font-lock-keywords + '("#[0-9a-fA-F]\\{3\\}[0-9a-fA-F]\\{3\\}?" + (0 (rainbow-colorize-itself))) + "Font-lock keywords to add for hexadecimal colors.") + +;; rgb() colors +(defvar rainbow-html-rgb-colors-font-lock-keywords + '(("rgb(\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*)" + (0 (rainbow-colorize-rgb))) + ("rgba(\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*\\([0-9]\\{1,3\\}\\(?:\s*%\\)?\\)\s*,\s*[0-9]\\{1,3\\}\s*%?\s*)" + (0 (rainbow-colorize-rgb)))) + "Font-lock keywords to add for RGB colors.") + +;; HTML colors name +(defvar rainbow-html-colors-font-lock-keywords nil + "Font-lock keywords to add for HTML colors.") +(make-variable-buffer-local 'rainbow-html-colors-font-lock-keywords) + +(defcustom rainbow-html-colors-alist + '(("black" . "#000000") + ("silver" . "#C0C0C0") + ("gray" . "#808080") + ("white" . "#FFFFFF") + ("maroon" . "#800000") + ("red" . "#FF0000") + ("purple" . "#800080") + ("fuchsia" . "#FF00FF") + ("green" . "#008000") + ("lime" . "#00FF00") + ("olive" . "#808000") + ("yellow" . "#FFFF00") + ("navy" . "#000080") + ("blue" . "#0000FF") + ("teal" . "#008080") + ("aqua" . "#00FFFF")) + "Alist of HTML colors. +Each entry should have the form (COLOR-NAME . HEXADECIMAL-COLOR)." + :group 'rainbow) + +(defcustom rainbow-html-colors-major-mode-list + '(html-mode css-mode php-mode nxml-mode xml-mode) + "List of major mode where HTML colors are enabled when +`rainbow-html-colors' is set to auto." + :group 'rainbow) + +(defcustom rainbow-html-colors 'auto + "When to enable HTML colors. +If set to t, the HTML colors will be enabled. If set to nil, the +HTML colors will not be enabled. If set to auto, the HTML colors +will be enabled if a major mode has been detected from the +`rainbow-html-colors-major-mode-list'." + :group 'rainbow) + +;; X colors +(defvar rainbow-x-colors-font-lock-keywords + `(,(regexp-opt (x-defined-colors) 'words) + (0 (rainbow-colorize-itself))) + "Font-lock keywords to add for X colors.") + +(defcustom rainbow-x-colors-major-mode-list + '(emacs-lisp-mode lisp-interaction-mode c-mode c++-mode java-mode) + "List of major mode where X colors are enabled when +`rainbow-x-colors' is set to auto." + :group 'rainbow) + +(defcustom rainbow-x-colors 'auto + "When to enable X colors. +If set to t, the X colors will be enabled. If set to nil, the +X colors will not be enabled. If set to auto, the X colors +will be enabled if a major mode has been detected from the +`rainbow-x-colors-major-mode-list'." + :group 'rainbow) + +;; Functions +(defun rainbow-colorize-match (color) + "Return a matched string propertized with a face whose +background is COLOR. The foreground is computed using +`rainbow-color-luminance', and is either white or black." + (put-text-property + (match-beginning 0) (match-end 0) + 'face `((:foreground ,(if (> 128.0 (rainbow-x-color-luminance color)) + "white" "black")) + (:background ,color)))) + +(defun rainbow-colorize-itself () + "Colorize a match with itself." + (rainbow-colorize-match (match-string-no-properties 0))) + +(defun rainbow-colorize-by-assoc (assoc-list) + "Colorize a match with its association from ASSOC-LIST." + (rainbow-colorize-match (cdr (assoc (match-string-no-properties 0) assoc-list)))) + +(defun rainbow-rgb-relative-to-absolute (number) + "Convert a relative NUMBER to absolute. If NUMBER is absolute, return NUMBER. +This will convert \"80 %\" to 204, \"100 %\" to 255 but \"123\" to \"123\"" + (let ((string-length (- (length number) 1))) + ;; Is this a number with %? + (if (eq (elt number string-length) ?%) + (/ (* (string-to-number (substring number 0 string-length)) 255) 100) + (string-to-number number)))) + +(defun rainbow-colorize-rgb () + "Colorize a match with itself." + (let ((r (rainbow-rgb-relative-to-absolute (match-string-no-properties 1))) + (g (rainbow-rgb-relative-to-absolute (match-string-no-properties 2))) + (b (rainbow-rgb-relative-to-absolute (match-string-no-properties 3)))) + (rainbow-colorize-match (format "#%02X%02X%02X" r g b)))) + +(defun rainbow-color-luminance (red green blue) + "Calculate the luminance of color composed of RED, BLUE and GREEN." + (floor (+ (* .2126 red) (* .7152 green) (* .0722 blue)) 256)) + +(defun rainbow-x-color-luminance (color) + "Calculate the luminance of a color string (e.g. \"#ffaa00\", \"blue\")." + (let* ((values (x-color-values color)) + (r (car values)) + (g (cadr values)) + (b (caddr values))) + (rainbow-color-luminance r g b))) + +(defun rainbow-turn-on () + "Turn on raibow-mode." + (font-lock-add-keywords nil + (list rainbow-hexadecimal-colors-font-lock-keywords)) + ;; Activate X colors? + (when (or (eq rainbow-x-colors t) + (and (eq rainbow-x-colors 'auto) + (memq major-mode rainbow-x-colors-major-mode-list))) + (font-lock-add-keywords nil + (list rainbow-x-colors-font-lock-keywords))) + ;; Activate HTML colors? + (when (or (eq rainbow-html-colors t) + (and (eq rainbow-html-colors 'auto) + (memq major-mode rainbow-html-colors-major-mode-list))) + (setq rainbow-html-colors-font-lock-keywords + `(,(regexp-opt (mapcar 'car rainbow-html-colors-alist) 'words) + (0 (rainbow-colorize-by-assoc rainbow-html-colors-alist)))) + (font-lock-add-keywords nil + `(,rainbow-html-colors-font-lock-keywords + ,@rainbow-html-rgb-colors-font-lock-keywords)))) + +(defun rainbow-turn-off () + "Turn off rainbow-mode." + (font-lock-remove-keywords + nil + (list + rainbow-hexadecimal-colors-font-lock-keywords + rainbow-html-colors-font-lock-keywords + rainbow-x-colors-font-lock-keywords + rainbow-html-rgb-colors-font-lock-keywords))) + +;;;###autoload +(define-minor-mode rainbow-mode + "Colorize strings that represent colors. +This will fontify with colors the string like \"#aabbcc\" or \"blue\"" + :lighter " Rbow" + (progn + (if rainbow-mode + (rainbow-turn-on) + (rainbow-turn-off)) + ;; Turn on font lock + (font-lock-mode 1))) + +(provide 'rainbow-mode) diff --git a/install.bat b/install.bat index 3dfeb83..e3c524e 100644 --- a/install.bat +++ b/install.bat @@ -1,5 +1,7 @@ @echo off REM An install script for windows +echo "Copying .emacs to %APPDATA%\\" copy /Y .emacs %APPDATA%\ +echo "Copying .emacs.d to %APPDATA%\\" copy /Y .emacs.d %APPDATA%\ \ No newline at end of file diff --git a/install.sh b/install.sh index bcbbf7b..3e1a96a 100755 --- a/install.sh +++ b/install.sh @@ -2,11 +2,23 @@ INSTALL_BASEFILE=`readlink -f $0` INSTALL_BASEDIR=`dirname $INSTALL_BASEFILE` # EMACS +echo "Linking $INSTALL_BASEDIR/.emacs to $HOME/.emacs" ln -sf $INSTALL_BASEDIR/.emacs $HOME/.emacs if [ -d $HOME/.emacs.d ]; then - rm -rf $HOME/.emacs.d + if [ -d $HOME/.emacs.d_backup ]; then + echo "Removing old $HOME/.emacs.d_backup" + rm -rf $HOME/.emacs.d_backup + fi + echo "Moving old $HOME/.emacs.d" + mv $HOME/.emacs.d $HOME/.emacs.d_backup fi +echo "Linking $INSTALL_BASEDIR/.emacs to $HOME/.emacs" ln -sf $INSTALL_BASEDIR/.emacs.d $HOME/ # XDEFAULTS -ln -sf $INSTALL_BASEDIR/.Xdefaults $HOME/.Xdefaults \ No newline at end of file +echo "Linking $INSTALL_BASEDIR/.Xdefaults to $HOME/.Xdefaults" +ln -sf $INSTALL_BASEDIR/.Xdefaults $HOME/.Xdefaults + +# XMODMAP +echo "Linking $INSTALL_BASEDIR/.Xmodmap to $HOME/.Xmodmap" +ln -sf $INSTALL_BASEDIR/.Xmodmap $HOME/.Xmodmap \ No newline at end of file -- cgit v1.2.3-54-g00ecf