Rewrote core initfiles: add mod-ac, mod-fly & mod-git
* mod-ac: fuzzy and unintrusive auto-complete * mod-fly: on-the-fly syntax and spell checking * mod-git: git-gutter and git-related modes
This commit is contained in:
parent
b53dfd6369
commit
30845199b5
12 changed files with 224 additions and 191 deletions
55
modules/mod-ac.el
Normal file
55
modules/mod-ac.el
Normal file
|
@ -0,0 +1,55 @@
|
|||
(require-packages
|
||||
'(auto-complete ; self-explanity
|
||||
auto-complete-config ; its default config
|
||||
fuzzy ; fuzzy search engine for auto-complete
|
||||
))
|
||||
|
||||
;;;; Auto-completion ;;;;;;;;;;;;;;
|
||||
|
||||
(ac-config-default)
|
||||
(ac-linum-workaround) ; Fix line number flux bug
|
||||
|
||||
(add-hook 'prog-mode-hook 'enable-path-completion)
|
||||
(setq ac-auto-show-menu nil ; Suggestions box must be invoked manually (see core-keymaps.el)
|
||||
ac-use-menu-map t ; Enable ac-menu-map map when menu is open
|
||||
ac-us-quick-help nil ; Don't show tooltips unless invoked (see core-keymaps.el)
|
||||
ac-fuzzy-cursor-color nil)
|
||||
|
||||
(defun enable-path-completion ()
|
||||
(add-to-list 'ac-sources 'ac-source-filename)
|
||||
(add-to-list 'ac-sources 'ac-source-files-in-current-dir))
|
||||
|
||||
;; Tell ido not to care about case
|
||||
(setq completion-ignore-case t)
|
||||
|
||||
;;; Filters ido-matches setting acronynm matches in front of the results
|
||||
(defadvice ido-set-matches-1 (after ido-smex-acronym-matches activate)
|
||||
(if (and (fboundp 'smex-already-running) (smex-already-running)
|
||||
(> (length ido-text) 1))
|
||||
(let ((regex (concat "^" (mapconcat 'char-to-string ido-text "[^-]*-")))
|
||||
(acronym-matches (list))
|
||||
(remove-regexes '("-menu-")))
|
||||
;; Creating the list of the results to be set as first
|
||||
(dolist (item items)
|
||||
(if (string-match (concat regex "[^-]*$") item) ;; strict match
|
||||
(add-to-list 'acronym-matches item)
|
||||
(if (string-match regex item) ;; appending relaxed match
|
||||
(add-to-list 'acronym-matches item t))))
|
||||
|
||||
;; Filtering ad-return-value
|
||||
(dolist (to_remove remove-regexes)
|
||||
(setq ad-return-value
|
||||
(delete-if (lambda (item)
|
||||
(string-match to_remove item))
|
||||
ad-return-value)))
|
||||
|
||||
;; Creating resulting list
|
||||
(setq ad-return-value
|
||||
(append acronym-matches
|
||||
ad-return-value))
|
||||
|
||||
(delete-dups ad-return-value)
|
||||
(reverse ad-return-value))))
|
||||
|
||||
;;
|
||||
(provide 'mod-ac)
|
17
modules/mod-fly.el
Normal file
17
modules/mod-fly.el
Normal file
|
@ -0,0 +1,17 @@
|
|||
(require-packages
|
||||
'(flycheck ; syntax checker
|
||||
flyspell ; spell checker
|
||||
))
|
||||
|
||||
(setq ispell-program-name "aspell")
|
||||
(setq ispell-list-command "--list")
|
||||
(setq flycheck-indication-mode 'right-fringe)
|
||||
|
||||
(setq-default flycheck-disabled-checkers '(emacs-lisp-checkdoc))
|
||||
|
||||
(add-hook 'prog-mode-hook #'global-flycheck-mode)
|
||||
(add-hook 'text-mode-hook (lambda () (flyspell-mode 1)))
|
||||
(add-hook 'conf-mode-hook (lambda () (flyspell-mode 1)))
|
||||
|
||||
;;
|
||||
(provide 'mod-fly)
|
|
@ -6,9 +6,20 @@
|
|||
git-gutter-fringe
|
||||
))
|
||||
|
||||
(global-git-gutter-mode t)
|
||||
(setq git-gutter-fr:side 'right-fringe)
|
||||
;; (diminish 'git-gutter-mode)
|
||||
(custom-set-variables '(git-gutter:lighter " !"))
|
||||
(custom-set-variables '(git-gutter:verbosity 0))
|
||||
|
||||
(set-face-foreground 'git-gutter-fr:modified "#555555")
|
||||
(set-face-background 'git-gutter-fr:modified "#444444")
|
||||
(set-face-foreground 'git-gutter-fr:deleted "#995555")
|
||||
(set-face-background 'git-gutter-fr:deleted "#884444")
|
||||
(set-face-foreground 'git-gutter-fr:added "#559955")
|
||||
(set-face-background 'git-gutter-fr:added "#448844")
|
||||
|
||||
; (setq git-gutter-fr:side 'right-fringe)
|
||||
(global-git-gutter-mode t)
|
||||
|
||||
(add-hook 'git-gutter-mode-on-hook
|
||||
(lambda() (fringe-mode '(4 . 8))))
|
||||
;;
|
||||
(provide 'mod-git)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue