Sfoglia il codice sorgente

Trying to improve zsh, git, and Emacs for new users:

  * Emacs: Update color theme, with improved colors for ERB,
    whitespace, and error messages (flymake).

  * Emacs: Change the frame title so it displays the full name of the
    file that is currently being edited.

  * Emacs: Add a message to the frame title when a buffer hasn't yet
    been saved to a file.

  * Emacs: Typing while text is selected (there is an active region)
    will now replace the selection with whatever you type.

  * Emacs: Add a major-mode for editing YAML files.

  * Git: Ignore Emacs temporary auto-save files so they don't get
    added when you do a `git add .'

  * ZSH: Auto-correction is now case-sensitive and won't try to help
    you pick the correct case.

  * ZSH: The `e' alias is now a function that tries really hard to
    make sure there's a running Emacs to connect to.

  * Linux Desktop: Automatically start an Emacs daemon when you
    log-in.
master
Peter J. Jones 7 anni fa
parent
commit
f9bb17b620
12 ha cambiato i file con 235 aggiunte e 95 eliminazioni
  1. 27
    0
      ChangeLog
  2. 1
    1
      GNUmakefile
  3. 26
    1
      emacs/emacsrc.el
  4. 6
    0
      emacs/lib/code.el
  5. 134
    89
      emacs/themes/devalot-theme.el
  6. 8
    0
      git/GNUmakefile
  7. 1
    0
      git/ignore
  8. 8
    1
      mk/install.mk
  9. 1
    0
      xorg/GNUmakefile
  10. 5
    0
      xorg/xsession
  11. 1
    0
      zsh/GNUmakefile
  12. 17
    3
      zsh/zshrc

+ 27
- 0
ChangeLog Vedi File

@@ -0,0 +1,27 @@
2012-07-05 Peter Jones <pjones@pmade.com>

* Emacs: Update color theme, with improved colors for ERB,
whitespace, and error messages (flymake).

* Emacs: Change the frame title so it displays the full name of
the file that is currently being edited.

* Emacs: Add a message to the frame title when a buffer hasn't yet
been saved to a file.

* Emacs: Typing while text is selected (there is an active region)
will now replace the selection with whatever you type.

* Emacs: Add a major-mode for editing YAML files.

* Git: Ignore Emacs temporary auto-save files so they don't get
added when you do a `git add .'

* ZSH: Auto-correction is now case-sensitive and won't try to help
you pick the correct case.

* ZSH: The `e' alias is now a function that tries really hard to
make sure there's a running Emacs to connect to.

* Linux Desktop: Automatically start an Emacs daemon when you
log-in.

+ 1
- 1
GNUmakefile Vedi File

@@ -3,5 +3,5 @@ include mk/install.mk
include mk/dirs.mk

##############################################################################
DIRS = emacs ruby xorg zsh
DIRS = git emacs ruby xorg zsh
$(eval $(call DESCEND_INTO_DIRECTORIES,$(DIRS)))

+ 26
- 1
emacs/emacsrc.el Vedi File

@@ -10,6 +10,8 @@
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/") t)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)

(package-initialize)

@@ -17,7 +19,7 @@
(package-refresh-contents))

;; Add in your own as you wish:
(defvar my-packages '(magit flymake-ruby ruby-end inf-ruby)
(defvar my-packages '(magit flymake-ruby ruby-end inf-ruby yaml-mode gist)
"A list of packages to ensure are installed at launch.")

(dolist (p my-packages)
@@ -41,11 +43,34 @@
(setq-default indicate-buffer-boundaries 'left
indicate-empty-lines t)

;; Frame defaults
(defun pjones:frame-title-file-name ()
(let* ((home (expand-file-name "~"))
(end (length home))
(start (and buffer-file-name (substring buffer-file-name 0 end)))
(under-home (and start (string= home start))))
(cond (under-home
(concat "~/" (file-relative-name buffer-file-name "~")))
(buffer-file-name buffer-file-name)
(dired-directory
(if (listp dired-directory) (car dired-directory) dired-directory))
(t (buffer-name)))))

(defun pjones:frame-title-not-saved ()
(if (buffer-modified-p) " (NOT SAVED)"))

(setq default-frame-alist '((cursor-type . bar))
frame-title-format '((:eval (pjones:frame-title-file-name))
(:eval (pjones:frame-title-not-saved))))

;; Turn off the menu bar in text mode, but leave it on in the GUI.
(setq window-system-default-frame-alist
'((x (menu-bar-lines . 1) (tool-bar-lines . 1))
(nil (menu-bar-lines . 0) (tool-bar-lines . 0))))

;; Delete the region when you start typing
(delete-selection-mode)

;; Color theme
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
(load-theme 'devalot t)

+ 6
- 0
emacs/lib/code.el Vedi File

@@ -21,9 +21,15 @@
(add-to-list 'auto-mode-alist '("Rakefile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Gemfile$" . ruby-mode))
(add-to-list 'auto-mode-alist '("Capfile$" . ruby-mode))

(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))
(autoload 'yaml-mode "yaml-mode" "YAML Mode" t)


(add-hook 'ruby-mode-hook 'inf-ruby-keys)
(add-hook 'ruby-mode-hook 'flymake-ruby-load)
(add-hook 'ruby-mode-hook 'ruby-end-mode)
(add-hook 'yaml-mode-hook 'usk-programming-mode-hook)

;; Ruby embedded in HTML
(add-to-list 'load-path (concat user-emacs-directory "rhtml"))

+ 134
- 89
emacs/themes/devalot-theme.el Vedi File

@@ -1,113 +1,147 @@
;;; devalot-theme.el --- Solarized-based custom theme for faces

;; Copyright (C) 2012 Free Software Foundation, Inc.

;; Authors: Peter Jones <pjones@pmade.com>

;; 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 <http://www.gnu.org/licenses/>.

;;; devalot-theme.el --- Solarized-based custom theme for faces.
;;
;; Copyright (C) 2007-2012 Peter Jones <pjones@pmade.com>
;;
;; Permission is hereby granted, free of charge, to any person obtaining
;; a copy of this software and associated documentation files (the
;; "Software"), to deal in the Software without restriction, including
;; without limitation the rights to use, copy, modify, merge, publish,
;; distribute, sublicense, and/or sell copies of the Software, and to
;; permit persons to whom the Software is furnished to do so, subject to
;; the following conditions:
;;
;; The above copyright notice and this permission notice shall be
;; included in all copies or substantial portions of the Software.
;;
;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
;; EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
;; MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
;; NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
;; LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
;; OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
;; WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
;;
;;; Commentary

;;
;; The majority of the colors in this theme come from the Solarized
;; palette, which is released under an MIT license:
;; https://github.com/altercation/solarized.

;;
;;
;;; Code:

(deftheme devalot "A theme loosely based on solarized.")

;; Create some faces
(when (not (facep 'devalot-fixme-face))
(copy-face 'font-lock-warning-face 'devalot-fixme-face)
(setq devalot-fixme-face 'devalot-fixme-face))
;; Create the faces if they don't already exist.
(put 'devalot 'theme-immediate t)

;; Notes
;;; Notes
;; * To see all faces in effect: list-faces-display
(let ((yellow "#b58900")
(orange "#cb4b16")
(red "#dc322f")
(magenta "#d33682")
(violet "#6c71c4")
(blue "#268bd2")
(cyan "#2aa198")
(green "#859900")
(bg-normal "#222222")
(bg-off "#003340")
(bg-high "#083d4a")
(bg-low "#2a2a2a")
(bg-inverse "#fdf6e3")
(fg-normal "#839496")
(fg-low "#586e75")
(fg-high "#93a1a1")
(fg-inverse "#657b83"))
;; * To see all colors: list-colors-display
(let ((yellow "#b58900")
(yellow-high "#b5a924")
(orange "#cb4b16")
(orange-high "#cb683f")
(red "#dc322f")
(red-high "#dc5c5a")
(magenta "#d33682")
(magenta-high "#d36198")
(violet "#6c71c4")
(violet-high "#9396c4")
(blue "#268bd2")
(blue-high "#509cd2")
(cyan "#2aa198")
(cyan-high "#4aa19a")
(green "#859900")
(green-high "#88b324")
(bg-normal "#222222")
(bg-off "#003340")
(bg-high "#083d4a")
(bg-low "#2a2a2a")
(bg-inverse "#fdf6e3")
(fg-normal "#839496")
(fg-low "#586e75")
(fg-high "#93a1a1")
(fg-inverse "#657b83")
(class '((class color) (min-colors 89))))
(custom-theme-set-faces
'devalot
`(default ((((type graphic)) (:background ,bg-normal :foreground ,fg-normal))))
`(cursor ((t (:background ,yellow :foreground ,bg-normal))))
`(link ((t (:underline ,cyan))))
`(cursor ((t (:background ,magenta-high :foreground ,bg-normal))))
`(error ((t (:foreground ,red-high))))
`(warning ((t (:foreground ,yellow-high))))
`(success ((t (:foreground ,green-high))))
`(match ((t (:background ,bg-high :foreground ,fg-normal))))
`(fringe ((t (:background ,bg-low :foreground ,fg-low))))
`(lazy-highlight ((t (:background ,bg-inverse :foreground ,fg-inverse))))
`(isearch ((t (:background ,magenta :foreground ,bg-inverse))))
`(lazy-highlight ((t (:background ,bg-high :foreground ,magenta-high))))
`(isearch ((t (:background ,magenta :foreground ,bg-inverse :bold t))))
`(region ((t (:background ,bg-high))))
`(highlight ((t (:background ,green :foreground ,bg-inverse))))
`(hl-line ((t (:background ,green :foreground ,bg-inverse))))
`(highlight ((t (:background ,green-high :foreground ,bg-low))))
`(hl-line ((t (:inherit 'highlight))))

`(link ((,class (:underline ,blue-high :foreground ,fg-normal))
(t (:underline "blue" :foreground "blue"))))


;; Show paren
`(show-paren-match ((t (:background ,bg-inverse
:foreground ,blue
:bold t))))
`(show-paren-match ((t (:background ,bg-inverse :foreground ,blue :bold t))))

;; Font-lock
`(font-lock-builtin-face ((t (:foreground ,fg-low))))
`(font-lock-comment-delimiter-face ((t (:foreground ,fg-inverse :bold t))))
`(font-lock-comment-delimiter-face ((t (:foreground ,fg-low :bold t))))
`(font-lock-comment-face ((t (:foreground ,violet :italic t))))
`(font-lock-constant-face ((t (:foreground ,yellow))))
`(font-lock-function-name-face ((t (:foreground ,orange :bold t))))
`(font-lock-keyword-face ((t (:foreground ,green :bold t))))
`(font-lock-preprocessor-face ((t (:foreground ,red))))
`(font-lock-string-face ((t (:foreground ,cyan))))
`(font-lock-string-face ((t (:foreground ,violet-high))))
`(font-lock-type-face ((t (:foreground ,blue :bold t))))
`(font-lock-variable-name-face ((t (:foreground ,magenta))))
`(font-lock-warning-face ((t (:underline ,red))))
`(font-lock-variable-name-face ((t (:foreground ,magenta-high))))
`(font-lock-warning-face ((t (:foreground ,magenta :background ,bg-off :bold t))))

;; Minibuffer
`(minibuffer-noticeable-prompt ((t (:inherit 'font-lock-builtin-face :bold t))))
`(minibuffer-noticeable-prompt ((t (:foreground ,red-high :bold t))))
`(minibuffer-prompt ((t (:foreground ,magenta :bold t))))

;; Modeline and Things in the Modeline
`(modeline ((t (:background ,yellow :foreground ,bg-normal :box (:line-width 1 :style released-button)))))
`(mode-line-inactive ((t (:background ,bg-high :foreground ,fg-normal :box (:line-width 1 :style released-button)))))
`(modeline ((,class (:background ,green :foreground ,bg-normal :box (:line-width 1 :style released-button)))
(t (:background "green" :foreground "black"))))
`(mode-line-inactive ((t (:background ,bg-low :foreground ,fg-low :box (:line-width 1 :style released-button)))))
`(modeline-mousable ((t (:background ,bg-high :foreground ,fg-normal))))
`(modeline-mousable-minor-mode ((t (:background ,bg-high :foreground ,bg-high))))

;; Flyspell
`(flyspell-duplicate ((t (:underline ,yellow))))
`(flyspell-incorrect ((t (:underline ,red))))
`(flyspell-duplicate ((t (:foreground ,yellow-high :underline ,yellow))))
`(flyspell-incorrect ((t (:foreground ,magenta-high :underline ,red))))

;; Dired
`(dired-directory ((t (:foreground ,blue :bold t))))
`(dired-flagged ((t (:foreground ,magenta-high))))
`(dired-header ((t (:foreground ,orange))))
`(dired-ignored ((t (:foreground ,fg-low))))
`(dired-mark ((t (:foreground ,yellow))))
`(dired-marked ((t (:foreground ,yellow-high))))
`(dired-perm-write ((t (:foreground ,fg-high))))
`(dired-symlink ((t (:foreground ,cyan))))
`(dired-warning ((t (:underline ,yellow-high))))

;; Outline Mode
`(outline-1 ((t (:foreground ,blue :bold t))))
`(outline-2 ((t (:foreground ,violet :bold t))))
`(outline-3 ((t (:foreground ,magenta :bold nil))))
`(outline-4 ((t (:foreground ,yellow :bold nil))))
`(outline-5 ((t (:foreground ,cyan :bold nil))))
`(outline-1 ((,class (:foreground ,blue-high :bold t))
(t (:foreground "blue" :bold t))))
`(outline-2 ((,class (:foreground ,green-high :bold t))
(t (:foreground "green" :bold t))))
`(outline-3 ((,class (:foreground ,cyan-high :bold nil))
(t (:foreground "cyan" :bold t))))
`(outline-4 ((,class (:foreground ,orange :bold nil))
(t (:foreground "orange" :bold t))))
`(outline-5 ((,class (:foreground ,yellow-high :bold nil))
(t (:foreground "magenta"))))

;; Org-Mode
`(org-level-1 ((t (:inherit 'outline-1))))
`(org-level-2 ((t (:inherit 'outline-2))))
`(org-level-3 ((t (:inherit 'outline-3))))
`(org-level-4 ((t (:inherit 'outline-4))))
`(org-level-4 ((t (:inherit 'outline-4 :italic t))))
`(org-level-5 ((t (:inherit 'outline-5))))
`(org-archived ((t (:inherit 'font-lock-string-face))))
`(org-document-title ((t (:inherit 'font-lock-comment-delimiter-face))))
@@ -125,22 +159,33 @@
`(org-date ((t (:foreground ,fg-low))))
`(org-tag ((t (:foreground ,fg-low))))
`(org-tag-default ((t (:inherit 'org-tag))))
`(org-special-keyword ((t (:inherit 'org-tag))))
`(org-code ((t (:inherit 'font-lock-function-name-face :bold nil))))
`(org-hide ((t (:foreground ,bg-off))))
`(org-column ((t (:background ,bg-high))))
`(org-column-title ((t (:inherit 'mode-line :background ,orange))))
`(org-column ((t (:background ,bg-low))))
`(org-column-title ((t (:inherit 'mode-line :background ,orange-high))))
`(org-checkbox ((t (:inherit 'mode-line :background ,green))))
`(org-todo ((t (:inherit 'mode-line :background ,red))))
`(org-done ((t (:inherit 'mode-line :background ,green))))

`(org-hide ((,class (:foreground ,bg-off))
(t (:foreground "black"))))

`(org-special-keyword ((,class (:foreground ,fg-low))
(t (:foreground "gray"))))

`(org-code ((,class (:inherit 'font-lock-keyword-face :bold nil))
(nil (:foreground "green"))))

`(org-block ((t (:inherit 'org-code))))
`(org-block-begin-line ((t (:inherit 'org-special-keyword))))
`(org-block-end-line ((t (:inherit 'org-block-begin-line))))


;; ERB (Ruby Embedded in HTML)
`(erb-face ((t (:inherit 'default))))
`(erb-delim-face ((t (:foreground ,fg-low))))
`(erb-out-face ((t (:inherit 'default))))
`(erb-out-delim-face ((t (:foreground ,blue))))
`(erb-comment-delim-face ((t (:inherit 'font-lock-comment-delimiter-face))))
`(erb-comment-face ((t (:inherit 'font-lock-comment-face))))
`(erb-face ((t (:background ,bg-normal :foreground ,fg-normal))))
`(erb-delim-face ((,class (:foreground ,fg-low)) (t (:foreground "magenta"))))
`(erb-out-face ((t (:background ,bg-normal :foreground ,fg-normal))))
`(erb-out-delim-face ((,class (:foreground ,blue :background ,bg-normal)) (t (:foreground "blue"))))
`(erb-comment-delim-face ((t (:foreground ,fg-low :bold t))))
`(erb-comment-face ((t (:foreground ,violet :italic t))))

;; Diff Mode
`(diff-added ((t (:foreground ,green))))
@@ -165,8 +210,8 @@
`(compilation-info ((t (:inherit 'font-lock-string-face :bold t))))
`(compilation-error ((t (:underline ,red :bold t))))
`(compilation-line-number ((t (:foreground ,orange :bold t))))
`(flymake-errline ((t :underline ,red)))
`(flymake-warnline ((t :underline ,yellow)))
`(flymake-errline ((t :underline ,magenta-high :background ,bg-off, :foreground ,magenta-high)))
`(flymake-warnline ((t :underline ,yellow ,bg-normal)))

;; nXML
`(nxml-element-colon-face ((t (:inherit 'font-lock-type-face))))
@@ -185,8 +230,10 @@
`(nxml-comment-content-face ((t (:inherit 'font-lock-comment-face))))

;; ido
`(ido-first-match ((t (:inherit 'font-lock-string-face))))
`(ido-subdir ((t (:inherit 'font-lock-function-name-face))))
`(ido-first-match ((t (:foreground ,magenta-high))))
`(ido-only-match ((t (:foreground ,green :bold t))))
`(ido-subdir ((t (:foreground ,blue :bold t))))
`(ido-virtual ((t (:foreground ,fg-low))))

;; rcIRC
`(rcirc-track-nick ((t (:foreground ,fg-low :bold t))))
@@ -209,11 +256,9 @@

;; Whitespace Mode
`(whitespace-tab ((t (:background ,bg-low))))
`(whitespace-trailing ((t (:inherit 'default))))
`(whitespace-line ((t (:background ,bg-low))))

;; Non-Standard Faces
`(devalot-fixme-face ((t (:background ,bg-inverse :foreground ,red :bold t :box (:line-width 1 :color ,bg-low)))))
`(whitespace-trailing ((t (:background ,bg-normal :foreground ,fg-normal))))
`(whitespace-empty ((t (:background ,bg-normal :foreground ,fg-normal))))
`(whitespace-line ((t (:background ,bg-normal :underline ,bg-off))))

;; Remaining Junk
`(completion-dynamic-face ((t (:inherit 'match))))))

+ 8
- 0
git/GNUmakefile Vedi File

@@ -0,0 +1,8 @@
##############################################################################
include ../mk/install.mk

################################################################################
install: ~/.gitignore
~/.gitignore: ignore
$(INSTALL_PLAIN_FILE) $< $@
git config --global core.excludesfile '~/.gitignore'

+ 1
- 0
git/ignore Vedi File

@@ -0,0 +1 @@
.#*

+ 8
- 1
mk/install.mk Vedi File

@@ -9,11 +9,12 @@ install:
##############################################################################
# $1: The file to install
# $2: The destination name
# $3: File mode (default 0644)
define INSTALL_FILE_AS
install: $(2)
$(2): $(1)
@ mkdir -p $(dir $2)
$(INSTALL_PLAIN_FILE) $$< $$@
install -m $(if $(3),$(3),0644) $$< $$@
endef

##############################################################################
@@ -22,6 +23,12 @@ define INSTALL_DOT_FILE
$(eval $(call INSTALL_FILE_AS,$(1),$(HOME)/.$(notdir $(1))))
endef

################################################################################
# $1: file to install as ~/.$(1) with the exec bits set.
define INSTALL_EXEC_DOT_FILE
$(eval $(call INSTALL_FILE_AS,$(1),$(HOME)/.$(notdir $(1)),0755))
endef

##############################################################################
# $1: The file to install
# $2: The directory to put it in

+ 1
- 0
xorg/GNUmakefile Vedi File

@@ -3,3 +3,4 @@ include ../mk/install.mk

##############################################################################
$(eval $(call INSTALL_DOT_FILE,Xdefaults))
$(eval $(call INSTALL_EXEC_DOT_FILE,xsession))

+ 5
- 0
xorg/xsession Vedi File

@@ -0,0 +1,5 @@
#!/bin/sh
x11vnc -bg -viewonly -forever
killall emacs
emacs --daemon
exec gnome-session

+ 1
- 0
zsh/GNUmakefile Vedi File

@@ -7,4 +7,5 @@ $(eval $(call INSTALL_DOT_FILE,zshrc))
##############################################################################
install: $(HOME)/.oh-my-zsh
$(HOME)/.oh-my-zsh: oh-my-zsh
rm -rf $@
cp -rp $< $@

+ 17
- 3
zsh/zshrc Vedi File

@@ -8,7 +8,7 @@ ZSH=$HOME/.oh-my-zsh
ZSH_THEME="kphoen"

# Set to this to use case-sensitive completion
# CASE_SENSITIVE="true"
CASE_SENSITIVE="true"

# Comment this out to disable weekly auto-update checks
DISABLE_AUTO_UPDATE="true"
@@ -27,7 +27,21 @@ COMPLETION_WAITING_DOTS="true"
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git)

alias e="emacsclient -nq -a emacs"
export EDITOR="emacsclient -t -a emacs"
################################################################################
# A helper function to get a file loaded into a running Emacs.
e () {
if ! pgrep emacs > /dev/null 2>&1; then
(cd && emacs --daemon > /dev/null 2>&1)
fi

frames=`emacsclient --eval '(length (frame-list))'`

if [ "$frames" -lt 2 ]; then
emacsclient -q --create-frame --no-wait "$@"
else
emacsclient -q --no-wait "$@"
fi
}

export EDITOR="emacsclient -t -a emacs"
source $ZSH/oh-my-zsh.sh

Loading…
Annulla
Salva