2019独角兽企业重金招聘Python工程师标准>>>
一个很好的 emacs 配置文件范例
(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.'(TeX-engine (quote xetex))'(TeX-shell "/bin/bash")'(TeX-view-program-list nil)'(TeX-view-program-selection (quote (((output-dvi style-pstricks) "dvips and gv") (output-dvi "xdvi") (output-pdf "xpdf") (output-html "xdg-open"))))'(gud-gdb-command-name "gdb --annotate=1")'(inhibit-startup-screen t)'(initial-buffer-choice t)'(initial-frame-alist (quote ((menu-bar-lines . 1))))'(initial-scratch-message "")'(large-file-warning-threshold nil)'(org-agenda-files (quote ("~/Desktop/todo.org")))'(org-agenda-include-diary t)'(org-log-into-drawer t)'(safe-local-variable-values (quote ((encoding . utf-8) (ruby-compilation-executable . "ruby") (ruby-compilation-executable . "ruby1.8") (ruby-compilation-executable . "ruby1.9") (ruby-compilation-executable . "rbx") (ruby-compilation-executable . "jruby")))))(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 (:inherit nil :stipple nil :inverse-video nil :background "#242424" :foreground "#E6E1DC" :box nil :strike-through nil :overline nil :underline nil :slant normal :weight normal :height 150 :width normal :foundry "apple" :family "Consolas"))))'(dired-directory ((t (:inherit font-lock-function-name-face :foreground "Green")))));;; Emacs general behavior setup
(setq backup-inhibited t)
(tool-bar-mode -1)
(setq user-full-name "Huang Liang")
(setq user-mail-address "lhuang@thoughtworks.com")
(setq tramp-default-user "lhuang" tramp-default-host "shell01.kp.realestate.com.au")
(setenv "PATH"(concat (getenv "PATH") ":" "/usr/local/bin" ":" "/usr/texbin" ":" "/opt/local/bin"));; nice scrolling
(set-scroll-bar-mode nil)
(setq mouse-wheel-scroll-amount '(1 ((shift) . 1) ((control) . nil)))
(setq mouse-wheel-progressive-speed t)
(setq scroll-margin 0scroll-conservatively 100000scroll-preserve-screen-position t);; suppress bell sound
(setq visible-bell 1)
(setq ring-bell-function 'ignore);; mode line settings
(line-number-mode t)
(column-number-mode t)
(size-indication-mode t);;Allow you to type just "y" instead of "yes" when you exit
(fset 'yes-or-no-p 'y-or-n-p)
;;set auto fill mode
(setq default-major-mode 'text-mode)
(add-hook 'text-mode-hook 'turn-on-auto-fill);;; Common Lisp with Slime
(set-language-environment "utf-8");;; Set Aspell
(setq-default ispell-program-name "/opt/local/bin/aspell")(add-to-list 'load-path "~/.emacs.d")
(add-to-list 'load-path "~/.emacs.d/elpa")(require 'package)
(defvar package-archives '("tromey" . "http://tromey.com/elpa/"))
(add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
(package-initialize)(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(unless (require 'el-get nil t)(url-retrieve"https://github.com/dimitri/el-get/raw/master/el-get-install.el"(lambda (s)(end-of-buffer)(eval-print-last-sexp))))(defun ruby-mode-hook ()(autoload 'ruby-mode "ruby-mode" nil t)(add-to-list 'auto-mode-alist '("Capfile" . ruby-mode))(add-to-list 'auto-mode-alist '("Gemfile" . ruby-mode))(add-to-list 'auto-mode-alist '("Rakefile" . ruby-mode))(add-to-list 'auto-mode-alist '("\\.rake\\'" . ruby-mode))(add-to-list 'auto-mode-alist '("\\.rb\\'" . ruby-mode))(add-to-list 'auto-mode-alist '("\\.ru\\'" . ruby-mode))(add-hook 'ruby-mode-hook '(lambda ();;; setup rsense(setq rsense-home "/usr/local")(add-to-list 'load-path (concat rsense-home "/etc"))(require 'rsense)(setq ruby-deep-arglist t)(setq ruby-deep-indent-paren nil)(setq c-tab-always-indent nil)(require 'inf-ruby)(require 'ruby-compilation)(define-key ruby-mode-map (kbd "C-.") 'ac-complete-rsense)(add-to-list 'ac-sources 'ac-source-rsense-method)(add-to-list 'ac-sources 'ac-source-rsense-constant)(define-key ruby-mode-map (kbd "C-c C-e") 'run-rails-test-or-ruby-buffer)(define-key ruby-mode-map (kbd "M-r") 'run-rails-test-or-ruby-buffer)(define-key ruby-mode-map (kbd "M-n") 'ruby-end-of-block)(define-key ruby-mode-map (kbd "M-p") 'ruby-beginning-of-block)(define-key ruby-mode-map (kbd "s-n") 'ruby-forward-sexp)(define-key ruby-mode-map (kbd "s-p") 'ruby-backward-sexp))))(defun rhtml-mode-hook ()(autoload 'rhtml-mode "rhtml-mode" nil t)(add-to-list 'auto-mode-alist '("\\.erb\\'" . rhtml-mode))(add-to-list 'auto-mode-alist '("\\.rjs\\'" . rhtml-mode)))(defun yaml-mode-hook ()(autoload 'yaml-mode "yaml-mode" nil t)(add-to-list 'auto-mode-alist '("\\.yml$" . yaml-mode))(add-to-list 'auto-mode-alist '("\\.yaml$" . yaml-mode)))(defun css-mode-hook ()(autoload 'css-mode "css-mode" nil t)(add-hook 'css-mode-hook '(lambda ()(setq css-indent-level 2)(setq css-indent-offset 2))))(defun is-rails-project ()(when (textmate-project-root)(file-exists-p (expand-file-name "config/environment.rb" (textmate-project-root)))))(defun run-rails-test-or-ruby-buffer ()(interactive)(if (is-rails-project)(let* ((path (buffer-file-name))(filename (file-name-nondirectory path))(test-path (expand-file-name "test" (textmate-project-root)))(command (list ruby-compilation-executable "-I" test-path path)))(pop-to-buffer (ruby-compilation-do filename command)))(ruby-compilation-this-buffer)))(defun auctex-hook ()(setq TeX-engine 'xetex)(TeX-global-PDF-mode t) ; PDF mode enable, not plain(define-key LaTeX-mode-map (kbd "TAB") 'TeX-complete-symbol)(setq TeX-auto-save t)(setenv "PATH" (concat (getenv "PATH") ":/usr/local/texlive/2010/bin/universal-darwin:/usr/local/bin"))(setq exec-path (append exec-path '("/usr/local/texlive/2010/bin/universal-darwin"))))(defun smex-hook ()(smex-initialize)(global-set-key (kbd "M-x") 'smex)(global-set-key (kbd "M-X") 'smex-major-mode-commands);; This is your old M-x.(global-set-key (kbd "C-c C-c M-x") 'execute-extended-command))(defun slime-hook ()
;;; Note that if you save a heap image, the character
;;; encoding specified on the command line will be preserved,
;;; and you won&#39;t have to specify the -K utf-8 any more.(setq inferior-lisp-program "/opt/local/bin/sbcl -K utf-8")(setq slime-net-coding-system &#39;utf-8-unix)(add-hook &#39;lisp-mode-hook &#39;slime-mode)(require &#39;slime)(load "slime-indentation.el")(slime-setup &#39;(slime-indentation slime-repl))(define-key slime-mode-map (kbd "C-c C-b") &#39;slime-eval-buffer)(define-key slime-mode-map (kbd "C-c C-c") &#39;slime-eval-defun))(defun ac-hook ()(ac-config-default))(defun paredit-hook ()(add-hook &#39;emacs-lisp-mode-hook (lambda () (paredit-mode &#43;1)))(add-hook &#39;lisp-mode-hook (lambda () (paredit-mode &#43;1)))(add-hook &#39;lisp-interaction-mode-hook (lambda () (paredit-mode &#43;1)))(add-hook &#39;clojure-mode-hook (lambda () (paredit-mode &#43;1)))(add-hook &#39;scheme-mode-hook (lambda () (paredit-mode &#43;1)))(define-key paredit-mode-map (kbd ")") &#39;paredit-close-parenthesis)(define-key paredit-mode-map (kbd "M-)") &#39;paredit-close-parenthesis-and-newline)) (defun clojure-hook ()(require &#39;clojure-mode)(define-key slime-mode-map (kbd "C-c C-b") &#39;slime-eval-buffer)(define-key slime-mode-map (kbd "C-c C-c") &#39;slime-eval-defun)(define-clojure-indent(describe &#39;defun)(testing &#39;defun)(given &#39;defun)(using &#39;defun)(with &#39;defun)(context &#39;defun)(it &#39;defun)(do-it &#39;defun)(should &#39;defun)(should-not &#39;defun)(should&#61; &#39;defun)(should-not&#61; &#39;defun)(should-fail &#39;defun)(should-throw &#39;defun)(should-not-throw &#39;defun)))(defun mmm-mode-hook ()(setq mmm-global-mode &#39;maybe)(setq mmm-submode-decoration-level 0)(mmm-add-group&#39;fancy-rhtml&#39;((html-css:submode css-mode:face mmm-code-submode-face:front "")))(setq mweb-filename-extensions &#39;("rhtml" "htm" "html" "erb" "rjs"))(multi-web-global-mode 1))(defun yasnippet-hook ()(require &#39;yasnippet)(setq yas/snippet-dirs &#39;("~/.emacs.d/el-get/yasnippet/snippets" "~/.emacs.d/snippets"))(yas/global-mode 1))(defun cucumber-mode-hook () (setq feature-default-language "en")(setq feature-default-i18n-file "~/.emacs.d/el-get/cucumber/i18n.yml");; load bundle snippets(yas/load-directory "~/.emacs.d/el-get/cucumber/snippets/feature-mode/")(load "feature-mode")(add-to-list &#39;auto-mode-alist &#39;("\\.feature$" . feature-mode)))(defun coffee-mode-hook ()(add-hook &#39;coffee-mode-hook&#39;(lambda() (set (make-local-variable &#39;tab-width) 2)))(setq coffee-js-mode &#39;js2-mode)(define-key coffee-mode-map (kbd "C-c C-c") &#39;coffee-compile-buffer))(defun mark-multiple-hook ()(require &#39;inline-string-rectangle)(global-set-key (kbd "C-x r t") &#39;inline-string-rectangle)(require &#39;mark-more-like-this)(global-set-key (kbd "C-<") &#39;mark-previous-like-this)(global-set-key (kbd "C->") &#39;mark-next-like-this)(global-set-key (kbd "C-*") &#39;mark-all-like-this)(require &#39;rename-sgml-tag)(define-key sgml-mode-map (kbd "C-c C-r") &#39;rename-sgml-tag))(defun ack-hook ()(autoload &#39;ack-and-a-half-same "ack-and-a-half" nil t)(autoload &#39;ack-and-a-half "ack-and-a-half" nil t)(autoload &#39;ack-and-a-half-find-file-same "ack-and-a-half" nil t)(autoload &#39;ack-and-a-half-find-file "ack-and-a-half" nil t);; Create shorter aliases(defalias &#39;ack &#39;ack-and-a-half)(defalias &#39;ack-same &#39;ack-and-a-half-same)(defalias &#39;ack-find-file &#39;ack-and-a-half-find-file)(defalias &#39;ack-find-file-same &#39;ack-and-a-half-find-file-same))(defun ess-hook ()(add-to-list &#39;ac-sources &#39;ac-source-R)(setq ess-use-auto-complete t))(defun workgroups-hook ()(require &#39;workgroups)(setq wg-prefix-key (kbd "C-c w"))(workgroups-mode 1)(setq wg-morph-on nil)(wg-load "~/.emacs.workgroups"))(defun js2-hook ()(setq js-indent-level 4indent-tabs-mode nil)(setq indent-line-function &#39;js-indent-line)(add-to-list &#39;auto-mode-alist &#39;("\\.js$" . js2-mode)))(defun slime-js-hook ()(add-hook &#39;js2-mode-hook(lambda ()(slime-js-minor-mode 1)))(add-hook &#39;css-mode-hook(lambda ()(define-key css-mode-map "\M-\C-x" &#39;slime-js-refresh-css)(define-key css-mode-map "\C-c\C-r" &#39;slime-js-embed-css))))(require &#39;package)
(setq package-archives (cons &#39;("tromey" . "http://tromey.com/elpa/") package-archives))
(package-initialize)(add-to-list &#39;load-path "~/.emacs.d/el-get/el-get")
(require &#39;el-get)(setq el-get-sources&#39;((:name color-theme-merbivore:type git:url "git://github.com/exceedhl/color-theme-merbivore.git":load "color-theme-merbivore.el")(:name ruby-mode :type elpa:load "ruby-mode.el":after (lambda () (ruby-mode-hook)))(:name inf-ruby :type elpa)(:name ruby-compilation :type elpa)(:name css-mode :type elpa :after (lambda () (css-mode-hook)))(:name textmate:type git:url "git://github.com/defunkt/textmate.el":load "textmate.el")(:name rhtml:type git:url "https://github.com/crazycode/rhtml.git":features rhtml-mode:after (lambda () (rhtml-mode-hook)))(:name yaml-mode :type git:url "http://github.com/yoshiki/yaml-mode.git":features yaml-mode:after (lambda () (yaml-mode-hook)));; (:name mmm-mode;; :features mmm-mode;; :after (lambda () (mmm-mode-hook)))(:name multi-web-mode:type git:url "https://github.com/fgallina/multi-web-mode.git":features multi-web-mode:after (lambda () (multi-web-mode-hook)))(:name smex :load "smex.el":after (lambda () (smex-hook)))(:name workgroups:url "https://github.com/tlh/workgroups.el.git":load "workgroups.el":after (lambda () (workgroups-hook)))(:name slime:url "https://github.com/antifuchs/slime.git":after (lambda () (slime-hook)))(:name ac-slime:type git:url "https://github.com/purcell/ac-slime.git":load "ac-slime.el":after (lambda () (add-hook &#39;slime-mode-hook &#39;set-up-slime-ac)(add-hook &#39;slime-repl-mode-hook &#39;set-up-slime-ac)))(:name slime-js:type git:url "https://github.com/swank-js/slime-js.git":load "slime-js.el":after (lambda () (slime-js-hook)))(:name paredit :type elpa:load "paredit.el":after (lambda () (paredit-hook)))(:name yasnippet :type git:url "https://github.com/capitaomorte/yasnippet.git":after (lambda () (yasnippet-hook)))(:name cucumber:type git:url "https://github.com/michaelklishin/cucumber.el.git":load "feature-mode.el":after (lambda () (cucumber-mode-hook)))(:name coffee-mode:after (lambda () (coffee-mode-hook)))(:name fastnav:type git:url "https://github.com/gleber/fastnav.el.git")(:name mark-multiple:type git:url "https://github.com/magnars/mark-multiple.el.git":after (lambda () (mark-multiple-hook)))(:name expand-region:type git:url "https://github.com/magnars/expand-region.el.git")(:name auto-complete:after (lambda () (ac-hook)))(:name clojure-mode:after (lambda () (clojure-hook)))(:name ack-and-a-half:type git:url "https://github.com/jhelwig/ack-and-a-half.git":after (lambda () (ack-hook)))(:name ess:after (lambda () (ess-hook)))(:name js2-mode:type git:load "js2-mode.el":url "https://github.com/mooz/js2-mode.git":after (lamba () (js2-hook)));; (:name auctex;; :build &#96;("./autogen.sh" "rm -rf /tmp/auctex" "mkdir /tmp/auctex" ,(concat "./configure --with-texmf-dir&#61;/tmp/auctex --with-lispdir&#61;&#96;pwd&#96; --with-emacs&#61;" el-get-emacs) "make");; :after (lambda () (auctex-hook)))(:name anything:load "anything-config.el")))
(setq my-packages (append &#39;(ido-hacks magit color-theme nxhtml coffee-mode ace-jump-mode) (mapcar &#39;el-get-source-name el-get-sources)))
(el-get &#39;sync my-packages);;; Muse
(require &#39;muse-init);;; Buffer switch
(global-set-key (kbd "C-x C-b") &#39;ibuffer)
(autoload &#39;ibuffer "ibuffer" "List buffers." t)(require &#39;ebs)
(ebs-initialize)
(global-set-key [(control tab)] &#39;ebs-switch-buffer)(require &#39;ido)
(ido-mode t)
(setq ido-enable-flex-matching t) ;; enable fuzzy matching;;; set recent-jump
(setq recent-jump-threshold 4)
(setq recent-jump-ring-length 10)
(global-set-key (kbd "s-P") &#39;recent-jump-backward)
(global-set-key (kbd "s-N") &#39;recent-jump-forward)
(require &#39;recent-jump)
(recent-jump-mode 1);;; number-window mode
(autoload &#39;window-number-meta-mode "window-number""A global minor mode that enables use of the M- prefix to select
windows, use &#96;window-number-mode&#39; to display the window numbers in
the mode-line."t)
(window-number-meta-mode 1)
(window-number-define-keys window-number-meta-mode-map "s-");;; set mic-paren
(require &#39;mic-paren)
(paren-activate) ;;; speedbar
;; (require &#39;sr-speedbar);;; peepopen
(require &#39;peepopen)
(textmate-mode)
(define-key *textmate-mode-map* (kbd "s-t") nil)
(setq ns-pop-up-frames nil);;; uniquify filename
(require &#39;uniquify)
(setq uniquify-buffer-name-style &#39;post-forward);;; set pending delete mode
(pending-delete-mode t);; show-paren-mode: subtle highlighting of matching parens (global-mode)
(show-paren-mode &#43;1)
(setq show-paren-style &#39;parenthesis);;; Global key bindings
(global-set-key (kbd "s-t") &#39;ido-switch-buffer)
(global-set-key (kbd "s-o") &#39;delete-other-windows)
(global-set-key (kbd "s-O") &#39;delete-window)
(global-set-key (kbd "
(global-set-key (kbd "s-d") &#39;kill-whole-line)
(global-set-key (kbd "s-p") &#39;backward-sexp)
(global-set-key (kbd "s-n") &#39;forward-sexp)
(global-set-key (kbd "M-p") &#39;backward-list)
(global-set-key (kbd "M-n") &#39;forward-list)
(global-set-key (kbd "M-u") &#39;backward-up-list)
(global-set-key (kbd "M-U") &#39;down-list)
(global-set-key (kbd "M-C-n") &#39;make-frame)
(global-set-key (kbd "
(global-set-key (kbd "
(global-set-key (kbd "C-c d e") &#39;kill-sexp)
(global-set-key (kbd "C-c d a") &#39;backward-kill-sexp)
(global-set-key (kbd "
(global-set-key (kbd "
(global-set-key (kbd "s-/") &#39;comment-region)
(global-set-key (kbd "s-?") &#39;uncomment-region)
(global-set-key (kbd "C-c f f") &#39;ack)
(global-set-key (kbd "C-c f o") &#39;occur)
(global-set-key (kbd "M-\\") &#39;just-one-space)
(global-set-key (kbd "M-|") &#39;delete-horizontal-space)
(global-set-key "\M-z" &#39;fastnav-zap-up-to-char-forward)
(global-set-key "\M-Z" &#39;fastnav-zap-up-to-char-backward)
(global-set-key "\M-m" &#39;fastnav-mark-to-char-forward)
(global-set-key "\M-M" &#39;fastnav-mark-to-char-backward)
(global-set-key (kbd "s-j") &#39;ace-jump-mode)
;; (global-set-key "\M-j" &#39;fastnav-jump-to-char-forward)
(global-set-key "\M-J" &#39;fastnav-jump-to-char-backward)
(global-set-key (kbd "s-r") &#39;repeat)
(global-set-key (kbd "s-w") &#39;er/expand-region)
(global-set-key (kbd "
;; (global-set-key (kbd "s-w") &#39;)
;; (global-set-key (kbd "s-q") &#39;quit-window)
(global-set-key [f5] &#39;slime-js-reload);;; Org mode key bindings
(global-set-key "\C-cl" &#39;org-store-link)
(global-set-key "\C-cc" &#39;org-capture)
(global-set-key "\C-ca" &#39;org-agenda)
(global-set-key "\C-cb" &#39;org-iswitchb)
;; MobileOrg settings
;; Set to the location of your Org files on your local system
(setq org-directory "~/Desktop")
;; Set to the name of the file where new notes will be stored
(setq org-mobile-inbox-for-pull "~/Desktop/todo.org")
;; Set to
(setq org-mobile-directory "~/Dropbox/MobileOrg");;; open previous and next line
;; Behave like vi&#39;s o command
(defun open-next-line (arg)"Move to the next line and then opens a line.See also &#96;newline-and-indent&#39;."(interactive "p")(end-of-line)(open-line arg)(next-line 1)(when newline-and-indent(indent-according-to-mode)));; Behave like vi&#39;s O command
(defun open-previous-line (arg)"Open a new line before the current one. See also &#96;newline-and-indent&#39;."(interactive "p")(beginning-of-line)(open-line arg)(when newline-and-indent(indent-according-to-mode)));; Autoindent open-*-lines
(defvar newline-and-indent t"Modify the behavior of the open-*-line functions to cause them to autoindent.")(global-set-key (kbd "
(global-set-key (kbd "
(setq delete-by-moving-to-trash t);; (setq cursor-type &#39;bar)
(put &#39;dired-find-alternate-file &#39;disabled nil);;; set shell mode
(defun shell-mode-hook ()(interactive)(setq sh-basic-offset 2sh-indentation 2))
(add-hook &#39;sh-mode-hook &#39;shell-mode-hook);;; bind .m to octave mode
(add-to-list &#39;auto-mode-alist &#39;("\\.m$" . octave-mode));;; set color theme
(setq color-theme-is-global nil)
(defun color-theme-undo ()(interactive)(color-theme-reset-faces)(color-theme-snapshot));; backup current color theme
(fset &#39;color-theme-snapshot (color-theme-make-snapshot));;; set chinese font
(defun set-my-font (frame)(set-fontset-font (frame-parameter frame &#39;font) &#39;han &#39;("STHeiTi" . "unicode-bmp")))(defun hide-menu-bar-line-in-console ()(if (display-graphic-p)(modify-frame-parameters frame &#39;((menu-bar-lines . 1)))(modify-frame-parameters frame &#39;((menu-bar-lines . 0)))))(require &#39;server)
(defun my-frame-config (frame)(if (server-running-p)(with-selected-frame frame(if (display-graphic-p)(progn(set-my-font frame)(color-theme-merbivore))(color-theme-undo))(blink-cursor-mode)(hide-menu-bar-line-in-console))))(my-frame-config (selected-frame))
(add-hook &#39;after-make-frame-functions &#39;my-frame-config);;; For standalone window mode
;; (color-theme-merbivore)
;; (set-my-font nil)
from&#xff1a;https://github.com/exceedhl/my-emacs/blob/master/.emacs#L6