Skip to content

Commit

Permalink
Tweaks.
Browse files Browse the repository at this point in the history
  • Loading branch information
ACEMerlin committed Feb 13, 2019
1 parent 072544f commit 6286b9f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 12 deletions.
2 changes: 2 additions & 0 deletions init.el
Expand Up @@ -63,6 +63,8 @@ Otherwise it's `/home/$USER/.emacs.d/'")
(require 'lain-font)
(require 'lain-evil)
(require 'lain-ivy)
(require 'lain-company)
(require 'lain-popup)

(-each lain-modules 'require)

Expand Down
15 changes: 8 additions & 7 deletions lisp/lain-company.el
Expand Up @@ -27,13 +27,14 @@
company-frontends
'(company-pseudo-tooltip-frontend
company-echo-metadata-frontend))
(defun lain/set-company-backend (mode backend)
(add-hook (intern (format "%s-hook" mode))
(lambda ()
(set (make-local-variable 'company-backends)
(if (consp backend)
(append backend (default-value 'company-backends))
(cons backend (default-value 'company-backends)))))))
(defun lain/set-company-backend (modes backend)
(--each modes
(add-hook (intern (format "%s-hook" it))
(lambda ()
(set (make-local-variable 'company-backends)
(if (consp backend)
(append backend (default-value 'company-backends))
(cons backend (default-value 'company-backends))))))))
:config
(global-company-mode +1))

Expand Down
12 changes: 11 additions & 1 deletion lisp/lain-core.el
Expand Up @@ -78,7 +78,8 @@
"pd" 'projectile-find-dir
"pD" 'lain/projectile-deer
"pk" 'projectile-kill-buffers
"pb" 'projectile-switch-to-buffer)
"pb" 'projectile-switch-to-buffer
"pW" 'lain/projectile-cleanup-whitespace)
:init
(when (executable-find "fd")
(setq
Expand All @@ -95,6 +96,15 @@
"Open `deer' from the root of the project."
(interactive)
(deer (projectile-ensure-project (projectile-project-root))))
(defun lain/projectile-cleanup-whitespace ()
"Run `whitespace-cleanup' on all project files"
(interactive)
(projectile-process-current-project-files
(lambda (file)
(with-temp-buffer
(insert-file-contents file)
(whitespace-cleanup)
(write-file file)))))
(projectile-mode +1))

(use-package smartparens
Expand Down
2 changes: 1 addition & 1 deletion lisp/lain-ruby.el
Expand Up @@ -41,7 +41,7 @@
'("^\\*robe-doc\\*$" :select t :slot 1 :size 0.3))
(lain/set-major-mode-leader-keys (inf-ruby-mode enh-ruby-mode)
"'" 'robe-start)
(lain/set-company-backend 'enh-ruby-mode 'company-robe))
(lain/set-company-backend '(enh-ruby-mode inf-ruby-mode) 'company-robe))

(use-package rbenv
:ghook ('enh-ruby-mode-hook 'lain/enable-rbenv)
Expand Down
4 changes: 1 addition & 3 deletions personal/lain.el.example
Expand Up @@ -13,14 +13,12 @@
:width normal)
lain-text-properties '(line-spacing 2 line-height 1.0)
lain-leader-key "SPC"
lain-emacs-leader-key "C-c"
lain-emacs-leader-key "M-SPC"
lain-major-mode-leader-key ","
lain-fullscreen-at-startup nil
lain-inhibit-startup-time nil
lain-modules
'(
lain-popup
lain-company
lain-utils
lain-emacs-lisp
;; lain-org
Expand Down

0 comments on commit 6286b9f

Please sign in to comment.