WIP refactoring of extensions
This commit is contained in:
parent
5a513a957c
commit
27711b5b40
|
@ -10,5 +10,3 @@
|
|||
;; highlight current line
|
||||
(global-hl-line-mode t)
|
||||
(set-face-background 'hl-line "#073642")
|
||||
;; relative line number
|
||||
(load-file (concat user-extensions-directory "linum-relativenumber.el"))
|
|
@ -0,0 +1,23 @@
|
|||
(defvar syl:extensions
|
||||
'(
|
||||
emacs-eclim
|
||||
flymake
|
||||
linum-relativenumber
|
||||
pymacs
|
||||
))
|
||||
|
||||
;; load extensions
|
||||
(dolist (ext syl:extensions)
|
||||
(add-to-list 'load-path
|
||||
(expand-file-name (concat user-extensions-directory ext "/"))))
|
||||
|
||||
;; initialize extensions
|
||||
(setq syl:extension-init-dir (concat user-emacs-directory "init-extension/"))
|
||||
(message (format "initializing extensions out of %s" syl:extension-init-dir))
|
||||
(dolist (ext syl:extensions)
|
||||
(let* ((initfile (concat syl:extension-init-dir (format "init-%s.el" ext))))
|
||||
(if (file-exists-p initfile)
|
||||
(progn (load initfile)
|
||||
(message (format "loaded %s" initfile))))))
|
||||
|
||||
(provide 'extensions)
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 22d7952dec8f2518af18f28ff6dd47e24109072c
|
|
@ -0,0 +1,27 @@
|
|||
;; Variables
|
||||
(setq eclim-auto-save t
|
||||
eclim-executable "~/Apps/eclipse4/eclim"
|
||||
eclimd-executable "~/Apps/eclipse4/eclimd"
|
||||
eclimd-wait-for-process nil
|
||||
eclimd-default-workspace "~/dev/eclimd-workspace"
|
||||
help-at-pt-display-when-idle t
|
||||
help-at-pt-timer-delay 0.1
|
||||
)
|
||||
|
||||
;; Load both eclim and eclimd (so that we can control eclimd from
|
||||
;; within Emacs)
|
||||
(require 'eclim)
|
||||
(require 'eclimd)
|
||||
|
||||
;; Call the help framework with the settings above & activate
|
||||
;; eclim-mode
|
||||
(help-at-pt-set-timer)
|
||||
(global-eclim-mode)
|
||||
|
||||
;; Hook eclim up with auto complete mode
|
||||
(require 'auto-complete-config)
|
||||
(ac-config-default)
|
||||
(require 'ac-emacs-eclim-source)
|
||||
(add-hook 'eclim-mode-hook (lambda ()
|
||||
(add-to-list 'ac-sources 'ac-source-emacs-eclim)
|
||||
(add-to-list 'ac-sources 'ac-source-emacs-eclim-c-dot)))
|
|
@ -0,0 +1,35 @@
|
|||
(defun flymake-create-copy-file ()
|
||||
"Create a copy local file"
|
||||
(let* ((temp-file (flymake-init-create-temp-buffer-copy
|
||||
'flymake-create-temp-inplace)))
|
||||
(file-relative-name
|
||||
temp-file
|
||||
(file-name-directory buffer-file-name))))
|
||||
|
||||
(defun flymake-command-parse (cmdline)
|
||||
"Parses the command line CMDLINE in a format compatible
|
||||
with flymake, as:(list cmd-name arg-list)
|
||||
|
||||
The CMDLINE should be something like:
|
||||
|
||||
flymake %f python custom.py %f
|
||||
|
||||
%f will be substituted with a temporary copy of the file that is
|
||||
currently being checked.
|
||||
"
|
||||
(let ((cmdline-subst (replace-regexp-in-string "%f" (flymake-create-copy-file) cmdline)))
|
||||
(setq cmdline-subst (split-string-and-unquote cmdline-subst))
|
||||
(list (first cmdline-subst) (rest cmdline-subst))
|
||||
))
|
||||
|
||||
|
||||
(when (load-file (concat user-extensions-directory "flymake-patch.el"))
|
||||
(setq flymake-info-line-regex
|
||||
(append flymake-info-line-regex '("unused$" "^redefinition" "used$")))
|
||||
(load-library "flymake-cursor"))
|
||||
|
||||
(defun epy-setup-checker (cmdline)
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
(list "\\.py\\'" (apply-partially 'flymake-command-parse cmdline)))
|
||||
)
|
||||
(epy-setup-checker "pyflakes %f")
|
|
@ -0,0 +1,31 @@
|
|||
(setq ropemacs-global-prefix "C-x /") ;; avoid conflict with p4 global prefix
|
||||
(require 'pymacs (concat user-extensions-directory "pymacs.el"))
|
||||
(defun setup-ropemacs ()
|
||||
(pymacs-load "ropemacs" "rope-")
|
||||
;; Stops from erroring if there's a syntax err
|
||||
(setq ropemacs-codeassist-maxfixes 3)
|
||||
;; Configurations
|
||||
(setq ropemacs-guess-project t)
|
||||
(setq ropemacs-enable-autoimport t)
|
||||
(setq ropemacs-autoimport-modules '("os" "shutil" "sys" "logging"))
|
||||
;; Adding hook to automatically open a rope project if there is one
|
||||
;; in the current or in the upper level directory
|
||||
(add-hook 'python-mode-hook
|
||||
(lambda ()
|
||||
(cond ((file-exists-p ".ropeproject")
|
||||
(rope-open-project default-directory))
|
||||
((file-exists-p "../.ropeproject")
|
||||
(rope-open-project (concat default-directory "..")))
|
||||
)))
|
||||
)
|
||||
|
||||
(eval-after-load 'python
|
||||
'(progn
|
||||
;; Ropemacs Configuration
|
||||
(setup-ropemacs)
|
||||
;; Not on all modes, please
|
||||
;; Be careful of mumamo, buffer file name nil
|
||||
(add-hook 'python-mode-hook (lambda () (if (buffer-file-name)
|
||||
(flymake-mode))))
|
||||
)
|
||||
)
|
37
init.el
37
init.el
|
@ -5,18 +5,22 @@
|
|||
(expand-file-name (concat user-emacs-directory "../"))
|
||||
"Emacs home directory.")
|
||||
|
||||
(defvar user-pre-directory
|
||||
(expand-file-name (concat user-emacs-directory "pre/"))
|
||||
"Pre-configuration scripts.")
|
||||
|
||||
(defvar user-post-directory
|
||||
(expand-file-name (concat user-emacs-directory "post/"))
|
||||
"Post-configuration setup.")
|
||||
(defvar user-config-directory
|
||||
(expand-file-name (concat user-emacs-directory "config/"))
|
||||
"Configuration scripts.")
|
||||
|
||||
(defvar user-extensions-directory
|
||||
(expand-file-name (concat user-emacs-directory "extensions/"))
|
||||
"Additional extensions.")
|
||||
|
||||
(defvar user-init-extension-directory
|
||||
(expand-file-name (concat user-emacs-directory "init-extension/"))
|
||||
"Extension initialization.")
|
||||
|
||||
(defvar user-init-package-directory
|
||||
(expand-file-name (concat user-emacs-directory "init-package/"))
|
||||
"Package initialization.")
|
||||
|
||||
(defvar host-directory
|
||||
(expand-file-name (concat user-emacs-directory "host/" system-name "/"))
|
||||
"Host specific configurations")
|
||||
|
@ -24,25 +28,18 @@
|
|||
(add-to-list 'load-path user-emacs-directory)
|
||||
(add-to-list 'load-path user-extensions-directory)
|
||||
|
||||
;; Pre-config =================================================================
|
||||
(progn (when (file-exists-p user-pre-directory)
|
||||
(dolist (l (directory-files user-pre-directory nil "^[^#].*el$"))
|
||||
(load (concat user-pre-directory l)))))
|
||||
;; Configuration ==============================================================
|
||||
(progn (when (file-exists-p user-config-directory)
|
||||
(dolist (l (directory-files user-config-directory nil "^[^#].*el$"))
|
||||
(load (concat user-config-directory l)))))
|
||||
|
||||
;; Package setup ==============================================================
|
||||
;; Setup ======================================================================
|
||||
(require 'funcs)
|
||||
(require 'funcs-virga)
|
||||
(require 'packages)
|
||||
(require 'extensions)
|
||||
(require 'keybindings)
|
||||
|
||||
;; Post-config ================================================================
|
||||
(progn (when (file-exists-p user-post-directory)
|
||||
(dolist (l (directory-files user-post-directory nil "^[^#].*el$"))
|
||||
(load (concat user-post-directory l)))))
|
||||
|
||||
;; Host config ================================================================
|
||||
(progn (when (file-exists-p host-directory)
|
||||
(dolist (l (directory-files host-directory nil "^[^#].*el$"))
|
||||
(load (concat host-directory l)))))
|
||||
|
||||
;; TODO refactor auto-loading functions for configuration files
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
;; Key Bindings ================================================================
|
||||
(global-set-key (kbd "C-x x") 'kill-this-buffer)
|
||||
(add-hook 'python-mode-hook (lambda ()
|
||||
(local-set-key "\C-c\C-c" 'syl-python-compile)))
|
||||
|
||||
(provide 'keybindings)
|
||||
|
|
|
@ -1,73 +0,0 @@
|
|||
|
||||
;; flymake -------------------------------------------------------------------
|
||||
(defun flymake-create-copy-file ()
|
||||
"Create a copy local file"
|
||||
(let* ((temp-file (flymake-init-create-temp-buffer-copy
|
||||
'flymake-create-temp-inplace)))
|
||||
(file-relative-name
|
||||
temp-file
|
||||
(file-name-directory buffer-file-name))))
|
||||
|
||||
(defun flymake-command-parse (cmdline)
|
||||
"Parses the command line CMDLINE in a format compatible
|
||||
with flymake, as:(list cmd-name arg-list)
|
||||
|
||||
The CMDLINE should be something like:
|
||||
|
||||
flymake %f python custom.py %f
|
||||
|
||||
%f will be substituted with a temporary copy of the file that is
|
||||
currently being checked.
|
||||
"
|
||||
(let ((cmdline-subst (replace-regexp-in-string "%f" (flymake-create-copy-file) cmdline)))
|
||||
(setq cmdline-subst (split-string-and-unquote cmdline-subst))
|
||||
(list (first cmdline-subst) (rest cmdline-subst))
|
||||
))
|
||||
|
||||
|
||||
(when (load-file (concat user-extensions-directory "flymake-patch.el"))
|
||||
(setq flymake-info-line-regex
|
||||
(append flymake-info-line-regex '("unused$" "^redefinition" "used$")))
|
||||
(load-library "flymake-cursor"))
|
||||
|
||||
(defun epy-setup-checker (cmdline)
|
||||
(add-to-list 'flymake-allowed-file-name-masks
|
||||
(list "\\.py\\'" (apply-partially 'flymake-command-parse cmdline)))
|
||||
)
|
||||
(epy-setup-checker "pyflakes %f")
|
||||
|
||||
;; pymacs --------------------------------------------------------------------
|
||||
(setq ropemacs-global-prefix "C-x /") ;; avoid conflict with p4 global prefix
|
||||
(require 'pymacs (concat user-extensions-directory "pymacs.el"))
|
||||
(defun setup-ropemacs ()
|
||||
(pymacs-load "ropemacs" "rope-")
|
||||
;; Stops from erroring if there's a syntax err
|
||||
(setq ropemacs-codeassist-maxfixes 3)
|
||||
;; Configurations
|
||||
(setq ropemacs-guess-project t)
|
||||
(setq ropemacs-enable-autoimport t)
|
||||
(setq ropemacs-autoimport-modules '("os" "shutil" "sys" "logging"))
|
||||
;; Adding hook to automatically open a rope project if there is one
|
||||
;; in the current or in the upper level directory
|
||||
(add-hook 'python-mode-hook
|
||||
(lambda ()
|
||||
(cond ((file-exists-p ".ropeproject")
|
||||
(rope-open-project default-directory))
|
||||
((file-exists-p "../.ropeproject")
|
||||
(rope-open-project (concat default-directory "..")))
|
||||
)))
|
||||
)
|
||||
|
||||
(eval-after-load 'python
|
||||
'(progn
|
||||
;; Ropemacs Configuration
|
||||
(setup-ropemacs)
|
||||
;; Not on all modes, please
|
||||
;; Be careful of mumamo, buffer file name nil
|
||||
(add-hook 'python-mode-hook (lambda () (if (buffer-file-name)
|
||||
(flymake-mode))))
|
||||
)
|
||||
)
|
||||
|
||||
(add-hook 'python-mode-hook (lambda ()
|
||||
(local-set-key "\C-c\C-c" 'syl-python-compile)))
|
Loading…
Reference in New Issue