zeroein.el 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #! /bin/sh
  2. ":"; exec ${EMACS:-emacs} -Q -l "$0" "$@" # -*-emacs-lisp-*-
  3. ;;; zeroein.el --- Zero setup Emacs IPython Notebook client
  4. ;; Copyright (C) 2012- Takafumi Arakaki
  5. ;; Author: Takafumi Arakaki
  6. ;; This file is NOT part of GNU Emacs.
  7. ;; zeroein.el is free software: you can redistribute it and/or modify
  8. ;; it under the terms of the GNU General Public License as published by
  9. ;; the Free Software Foundation, either version 3 of the License, or
  10. ;; (at your option) any later version.
  11. ;; zeroein.el is distributed in the hope that it will be useful,
  12. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;; GNU General Public License for more details.
  15. ;; You should have received a copy of the GNU General Public License
  16. ;; along with zeroein.el. If not, see <http://www.gnu.org/licenses/>.
  17. ;;; Commentary:
  18. ;;
  19. ;;; Code:
  20. (eval-when-compile (require 'cl))
  21. ;;; Utilities
  22. (defvar zeroein:lisp-dir
  23. (or (if load-file-name (file-name-directory load-file-name))
  24. default-directory))
  25. (defvar zeroein:root-dir
  26. (file-name-as-directory
  27. (expand-file-name ".." (file-name-as-directory zeroein:lisp-dir))))
  28. (defun zeroein:path (p &rest ps)
  29. (if ps
  30. (apply #'zeroein:path
  31. (concat (file-name-as-directory p) (car ps)) (cdr ps))
  32. (concat zeroein:root-dir p)))
  33. (defvar zeroein:dependencies
  34. '("nxhtml" "markdown-mode" "websocket" "request"
  35. "auto-complete" "popup" "fuzzy" "pos-tip" "smartrep"))
  36. ;; Loading the new python.el fails in Emacs 23.
  37. (when (>= emacs-major-version 24)
  38. (add-to-list 'zeroein:dependencies "python"))
  39. ;;; Install dependencies
  40. (call-process "git" nil (get-buffer "*Messages*") nil
  41. "submodule" "update" "--init")
  42. ;;; `load-path' configurations
  43. (add-to-list 'load-path (zeroein:path "lisp"))
  44. (add-to-list 'load-path (zeroein:path "lib" "nxhtml" "util"))
  45. (mapc (lambda (path) (add-to-list 'load-path (zeroein:path "lib" path)))
  46. zeroein:dependencies)
  47. ;;; Configurations
  48. (eval-when-compile (require 'ein-notebooklist))
  49. (require 'ein)
  50. ;; auto-complete
  51. (setq ein:use-auto-complete-superpack t)
  52. ;; (setq ein:use-smartrep t)
  53. (require 'auto-complete-config nil t)
  54. (declare-function global-auto-complete-mode "auto-complete.el")
  55. (when (featurep 'auto-complete-config)
  56. (ac-config-default)
  57. (add-to-list 'ac-dictionary-directories
  58. (zeroein:path "lib" "auto-complete" "dict"))
  59. (global-auto-complete-mode t))
  60. ;; MuMaMo
  61. (custom-set-faces
  62. '(mumamo-background-chunk-major
  63. ((((class color) (min-colors 88) (background dark)) nil)))
  64. ;; '(mumamo-background-chunk-submode1
  65. ;; ((((class color) (min-colors 88) (background dark)) nil)))
  66. )
  67. ;;; Workaround
  68. ;; Suppress this warning when using mumamo:
  69. ;; Warning: `font-lock-syntactic-keywords' is an obsolete variable (as of 24.1);
  70. ;; use `syntax-propertize-function' instead.
  71. (when (and (equal emacs-major-version 24)
  72. (equal emacs-minor-version 1))
  73. (eval-after-load "bytecomp"
  74. '(add-to-list 'byte-compile-not-obsolete-vars
  75. 'font-lock-syntactic-keywords)))
  76. ;; See: http://stackoverflow.com/a/5470584/727827
  77. ;;; Finally, open notebook list
  78. (if noninteractive
  79. (progn
  80. ;; When called in batch mode, print system info.
  81. (require 'ein-dev)
  82. (ein:dev-print-sys-info))
  83. ;; To make EIN configurable by --eval, use idle timer:
  84. (run-with-idle-timer 0 nil 'call-interactively 'ein:notebooklist-open))
  85. ;;; zeroein.el ends here