Majorly re-organize modules

- Split large modules into smaller parts (e.g. siren-text-manipulation)
- Organize modules into high level groups:
  - completion
  - core
  - editor
  - languages
  - linting
  - misc
  - navigation
  - projects
  - spelling
  - text-editing
  - version-control
  - windows
  - workspaces
This commit is contained in:
2018-05-20 17:31:11 +01:00
parent 3b07c4cfbf
commit 87a86191db
118 changed files with 592 additions and 463 deletions

View File

@@ -0,0 +1,28 @@
;;; siren-anzu.el --- jimeh's Emacs Siren: anzu configuration.
;;; Commentary:
;; Basic configuration for anzu.
;;; Code:
(use-package anzu
:config
(set-face-attribute 'anzu-mode-line nil
:foreground "yellow" :weight 'bold)
(setq anzu-mode-lighter ""
anzu-deactivate-region t
anzu-search-threshold 1000
anzu-replace-threshold 50
anzu-replace-to-string-separator " => ")
(global-set-key [remap query-replace] 'anzu-query-replace)
(global-set-key (kbd "C-c C-r") 'anzu-query-replace)
(global-set-key [remap query-replace-regexp] 'anzu-query-replace-regexp)
(global-set-key (kbd "C-x C-r") 'anzu-query-replace-regexp)
(global-anzu-mode +1))
(provide 'siren-anzu)
;;; siren-anzu.el ends here

View File

@@ -0,0 +1,25 @@
;;; siren-avy.el --- jimeh's Emacs Siren: avy configuration.
;;; Commentary:
;; Basic configuration for avy. Avy allows us to effectively navigate to
;; visible things.
;;; Code:
(use-package avy
:bind
("C-c j" . avy-goto-word-or-subword-1)
("C-c SPC" . avy-goto-char)
("M-o" . ace-window)
:config
(setq avy-background t
avy-style 'at-full))
(use-package ace-window
:bind
("M-o" . ace-window))
(provide 'siren-avy)
;;; siren-avy.el ends here

View File

@@ -0,0 +1,27 @@
;;; siren-dired.el --- jimeh's Emacs Siren: dired configuration.
;;; Commentary:
;; Basic configuration for dired.
;;; Code:
(require 'siren-linum)
(use-package dired+
:ensure nil ;; loaded from vendor
:demand
:hook (dired-mode . siren-dired-mode-setup)
:init
(defun siren-dired-mode-setup ()
(linum-mode t)
(define-key dired-mode-map (kbd "c") 'dired-create-directory)
(toggle-diredp-find-file-reuse-dir 1))
:config
(unbind-key "M-i" dired-mode-map)
(unbind-key "M-l" dired-mode-map))
(provide 'siren-dired)
;;; siren-dired.el ends here

View File

@@ -0,0 +1,20 @@
;;; siren-direx.el --- jimeh's Emacs Siren: direx configuration.
;;; Commentary:
;; Basic configuration for direx.
;;; Code:
(use-package direx
:bind ("C-x j" . direx-project:jump-to-project-root)
:hook (direx-mode . siren-direx-mode-setup)
:config
(setq direx:closed-icon " + "
direx:open-icon " - "))
(defun siren-direx-mode-setup ())
(provide 'siren-direx)
;;; siren-direx.el ends here

View File

@@ -0,0 +1,24 @@
;;; siren-dumb-jump.el --- jimeh's Emacs Siren: dumb-jump configuration.
;;; Commentary:
;; Basic configuration for dumb-jump.
;;; Code:
(use-package dumb-jump
:bind
("C-c C-j" . dumb-jump-go)
("C-c b" . dumb-jump-back)
("M-g o" . dumb-jump-go-other-window)
("M-g j" . dumb-jump-go)
("M-g b" . dumb-jump-back)
("M-g i" . dumb-jump-go-prompt)
("M-g x" . dumb-jump-go-prefer-external)
("M-g z" . dumb-jump-go-prefer-external-other-window)
:config
(setq dumb-jump-selector 'ivy))
(provide 'siren-dumb-jump)
;;; siren-dumb-jump.el ends here

View File

@@ -0,0 +1,38 @@
;;; siren-folding.el --- jimeh's Emacs Siren: folding configuration.
;;; Commentary:
;; Basic configuration for folding code.
;;; Code:
(use-package hideshowvis
:ensure nil ;; loaded from vendor
)
(defun siren-toggle-hiding (column)
"Toggle hiding/showing blocks via hs-mode.
Borrowed from: http://www.emacswiki.org/emacs/HideShow"
(interactive "P")
(if hs-minor-mode
(if (condition-case nil
(hs-toggle-hiding)
(error t))
(hs-show-all))
(siren-toggle-selective-display column)))
(defun siren-toggle-selective-display (column)
"Helper function for `siren-toggle-hiding'."
(interactive "P")
(set-selective-display
(or column
(unless selective-display
(1+ (current-column))))))
;; Keybindings
(global-set-key (kbd "C-=") 'siren-toggle-selective-display)
(global-set-key (kbd "C-c C-h") 'siren-toggle-hiding)
(provide 'siren-folding)
;;; siren-folding.el ends here

View File

@@ -0,0 +1,43 @@
;;; siren-full-ack.el --- jimeh's Emacs Siren: full-ack configuration.
;;; Commentary:
;; Basic configuration for full-ack.
;;; Code:
(use-package full-ack
:bind
("C-c C-a" . ack)
:config
(setq ack-arguments '("--sort-files"
"--ignore-dir=vendor/ruby"
"--ignore-dir=vendor/bundle"
"--ignore-dir=coverage"
"--ignore-dir=savefile"
"--ignore-dir=Godeps"
"--ignore-dir=elpa"
"--ignore-dir=docs"
"--ignore-dir=doc"
"--type-add=js=.js,.js.erb"
"--type-add=ruby=.jbuilder,.rabl"
"--type-add=html=.haml,.hamlc,.jade"
"--type-add=css=.sass,.scss,.styl"
"--type-set=coffee=.coffee"
"--type-set=cucumber=.feature")
ack-project-root-file-patterns '(".project\\'"
".xcodeproj\\'"
".sln\\'"
"\\`Project.ede\\'"
"\\`.git\\'"
"\\`.bzr\\'"
"\\`_darcs\\'"
"\\`.hg\\'"
"\\`Gemfile\\'"
"\\`Rakefile\\'"
"\\`Makefile\\'")
ack-prompt-for-directory 'unless-guessed))
(provide 'siren-full-ack)
;;; siren-full-ack.el ends here

View File

@@ -0,0 +1,44 @@
;;; siren-git-link.el --- jimeh's Emacs Siren: git-link configuration.
;;; Commentary:
;; Basic configuration for git-link.
;;; Code:
(use-package git-link
:bind
("C-c g" . git-link)
:config
(setq git-link-open-in-browser t)
;; Add custom handlers relevant only for machine with hostname "UAC00024".
(when (string= (system-name) "UAC00024")
(defun git-link-uac00024-bitbucket (hostname dirname filename branch commit start end)
(format "https://%s/projects/%srepos/%s/browse/%s"
"bitbucket.il2management.local"
(upcase (file-name-directory dirname))
(file-name-nondirectory dirname)
(concat filename
(unless (string= (or branch commit) "master")
(format "?at=%s" (or branch commit)))
(when start
(concat "#"
(if end (format "%s-%s" start end)
(format "%s" start)))))))
(defun git-link-commit-uac00024-bitbucket (hostname dirname commit)
(format "https://%s/projects/%srepos/%s/commits/%s"
"bitbucket.il2management.local"
(upcase (file-name-directory dirname))
(file-name-nondirectory dirname)
commit))
(add-to-list 'git-link-remote-alist
'("git" git-link-uac00024-bitbucket) t)
(add-to-list 'git-link-commit-remote-alist
'("git" git-link-commit-uac00024-bitbucket) t)))
(provide 'siren-git-link)
;;; siren-git-link.el ends here

View File

@@ -0,0 +1,71 @@
;;; siren-goto-symbol.el --- jimeh's Emacs Siren: goto-symbol.
;;; Commentary:
;; Basic goto-symbol functionality.
;;; Code:
;; Shamelessly ripped from Emacs Prelude.
(require 'imenu)
(use-package imenu-anywhere
:config
(set-default 'imenu-auto-rescan t)
(set-default 'imenu-max-item-length 160)
(set-default 'imenu-max-items 400))
(defun siren-flush-cache-and-goto-symbol ()
"Flush imenu cache."
(interactive)
(setq imenu--index-alist nil)
(siren-goto-symbol))
(defun siren-goto-symbol (&optional symbol-list)
"Refresh imenu and jump to a place in the buffer using Ido."
(interactive)
(cond
((not symbol-list)
(let (name-and-pos symbol-names position)
(while (progn
(imenu--cleanup)
(setq imenu--index-alist nil)
(siren-goto-symbol (imenu--make-index-alist))
(setq selected-symbol
(completing-read "Symbol? " (reverse symbol-names)))
(string= (car imenu--rescan-item) selected-symbol)))
(unless (and (boundp 'mark-active) mark-active)
(push-mark nil t nil))
(setq position (cdr (assoc selected-symbol name-and-pos)))
(cond
((overlayp position)
(goto-char (overlay-start position)))
(t
(goto-char position)))
(recenter)))
((listp symbol-list)
(dolist (symbol symbol-list)
(let (name position)
(cond
((and (listp symbol) (imenu--subalist-p symbol))
(siren-goto-symbol symbol))
((listp symbol)
(setq name (car symbol))
(setq position (cdr symbol)))
((stringp symbol)
(setq name symbol)
(setq position
(get-text-property 1 'org-imenu-marker symbol))))
(unless (or (null position) (null name)
(string= (car imenu--rescan-item) name))
(add-to-list 'symbol-names (substring-no-properties name))
(add-to-list 'name-and-pos (cons (substring-no-properties name)
position))))))))
(global-set-key (kbd "C-t") 'siren-goto-symbol)
(global-set-key (kbd "C-c C-t") 'siren-flush-cache-and-goto-symbol)
(global-set-key (kbd "C-c t") #'imenu-anywhere)
(provide 'siren-goto-symbol)
;;; siren-goto-symbol ends here.

View File

@@ -0,0 +1,20 @@
;;; siren-helm-ag.el --- jimeh's Emacs Siren: helm-ag configuration.
;;; Commentary:
;; Basic configuration for helm-ag.
;;; Code:
(require 'siren-helm)
(use-package helm-ag
:bind
("C-c C-s" . helm-do-ag)
("C-x C-'" . helm-do-ag-project-root)
:config
(setq helm-ag-ignore-patterns '("*.sql" "archive-contents")))
(provide 'siren-helm-ag)
;;; siren-helm-ag.el ends here

View File

@@ -0,0 +1,20 @@
;;; siren-helm-gtags.el --- jimeh's Emacs Siren: helm-gtags configuration.
;;; Commentary:
;; Basic configuration for helm-gtags.
;;; Code:
(require 'siren-helm)
(use-package helm-gtags
:defer t
:config
(setq helm-gtags-auto-update t
helm-gtags-direct-helm-completing t
helm-gtags-fuzzy-match t
helm-gtags-ignore-case t))
(provide 'siren-helm-gtags)
;;; siren-helm-gtags.el ends here

View File

@@ -0,0 +1,22 @@
;;; siren-helm-open-github.el --- jimeh's Emacs Siren: helm-open-github configuration.
;;; Commentary:
;; Basic configuration for helm-open-github.
;;; Code:
(require 'siren-helm)
(use-package helm-open-github
:bind
("C-c o f" . helm-open-github-from-file)
("C-c o c" . helm-open-github-from-commit)
("C-c o i" . helm-open-github-from-issues)
("C-c o p" . helm-open-github-from-pull-requests)
:config
(setq helm-open-github-commit-limit 10000))
(provide 'siren-helm-open-github)
;;; siren-helm-open-github.el ends here

View File

@@ -0,0 +1,19 @@
;;; siren-helm-swoop.el --- jimeh's Emacs Siren: helm-swoop configuration.
;;; Commentary:
;; Basic configuration for helm-swoop.
;;; Code:
(require 'siren-helm)
(use-package helm-swoop
:bind
("M-r" . helm-swoop-without-pre-input)
("M-R" . helm-swoop-back-to-last-point)
("C-c M-r" . helm-multi-swoop)
("C-x M-r" . helm-multi-swoop-all))
(provide 'siren-helm-swoop)
;;; siren-helm-swoop.el ends here

View File

@@ -0,0 +1,80 @@
;;; siren-helm.el --- jimeh's Emacs Siren: helm configuration.
;;; Commentary:
;; Basic configuration for helm.
;;; Code:
(use-package helm
:defer t
:hook ((helm-minibuffer-set-up . siren-helm--hide-minibuffer-maybe)
(helm-before-initialize . siren-helm--toggle-header-line)
(helm-minibuffer-set-up . siren-helm--popwin-help-mode-off)
(helm-cleanup . siren-helm--popwin-help-mode-on)
(helm-cleanup . siren-helm--show-neotree-maybe))
:init
;; From: https://www.reddit.com/r/emacs/comments/3asbyn/new_and_very_useful_helm_feature_enter_search/
(defun siren-helm--hide-minibuffer-maybe ()
(when (with-helm-buffer helm-echo-input-in-header-line)
(let ((ov (make-overlay (point-min) (point-max) nil nil t)))
(overlay-put ov 'window (selected-window))
(overlay-put ov 'face (let ((bg-color (face-background 'default nil)))
`(:background ,bg-color :foreground ,bg-color)))
(setq-local cursor-type nil))))
;; From: https://github.com/emacs-helm/helm/issues/918#issuecomment-81555133
(defun siren-helm--toggle-header-line ()
(if (= (length helm-sources) 1)
(set-face-attribute 'helm-source-header nil :height 0.1)
(set-face-attribute 'helm-source-header nil :height 1.0)))
;; From: https://github.com/emacs-helm/helm/wiki/Popwin
(defun siren-helm--popwin-help-mode-off ()
"Turn `popwin-mode' off for *Help* buffers."
(when (boundp 'popwin:special-display-config)
(customize-set-variable 'popwin:special-display-config
(delq 'help-mode popwin:special-display-config))))
;; From: https://github.com/emacs-helm/helm/wiki/Popwin
(defun siren-helm--popwin-help-mode-on ()
"Turn `popwin-mode' on for *Help* buffers."
(when (boundp 'popwin:special-display-config)
(customize-set-variable 'popwin:special-display-config
(add-to-list 'popwin:special-display-config 'help-mode nil #'eq))))
(defun siren-helm--hide-neotree (&rest plist)
(when (and (fboundp 'neotree-hide)
(fboundp 'neo-global--window-exists-p)
(neo-global--window-exists-p))
(setq siren-helm--did-hide-neotree t)
(neotree-hide)))
(defun siren-helm--show-neotree-maybe ()
(when (and (fboundp 'neotree-show)
siren-helm--did-hide-neotree)
(setq siren-helm--did-hide-neotree nil)
(run-with-timer 0.01 nil #'neotree-show)))
:config
(setq helm-autoresize-max-height 30
helm-autoresize-min-height 30
helm-autoresize-mode t
helm-buffer-max-length 64
helm-case-fold-search 'smart
helm-echo-input-in-header-line t
helm-file-name-case-fold-search 'smart
helm-split-window-default-side 'below
siren-helm--did-hide-neotree nil)
(advice-add 'helm :before 'siren-helm--hide-neotree))
(use-package helm-descbinds
:defer t)
(use-package helm-describe-modes
:defer t)
(provide 'siren-helm)
;;; siren-helm.el ends here

View File

@@ -0,0 +1,23 @@
;;; siren-highlight-symbol.el --- jimeh's Emacs Siren: highlight-symbol configuration.
;;; Commentary:
;; Basic configuration for highlight-symbol.
;;; Code:
(use-package highlight-symbol
:diminish highlight-symbol-mode
:bind
("C-c C-p" . highlight-symbol-prev)
("C-c C-n" . highlight-symbol-next)
:hook
(prog-mode . highlight-symbol-mode)
:config
(setq highlight-symbol-highlight-single-occurrence 'nil
highlight-symbol-idle-delay 0.5))
(provide 'siren-highlight-symbol)
;;; siren-highlight-symbol.el ends here

View File

@@ -0,0 +1,38 @@
;;; siren-move-beginning-of-line.el --- jimeh's Emacs Siren: move-beginning-of-line.
;;; Commentary:
;; Tweak behavior of C-a.
;;; Code:
(defun siren-move-beginning-of-line (arg)
"Move point back to indentation or beginning of line.
Move point to the first non-whitespace character on this line.
If point is already there, move to the beginning of the line.
Effectively toggle between the first non-whitespace character and
the beginning of the line.
If ARG is not nil or 1, move forward ARG - 1 lines first. If
point reaches the beginning or end of the buffer, stop there.
Borrowed from: http://emacsredux.com/blog/2013/05/22/smarter-navigation-to-the-beginning-of-a-line/"
(interactive "^p")
(setq arg (or arg 1))
;; Move lines first
(when (/= arg 1)
(let ((line-move-visual nil))
(forward-line (1- arg))))
(let ((orig-point (point)))
(back-to-indentation)
(when (= orig-point (point))
(move-beginning-of-line 1))))
;; Use siren-move-beginning-of-line
(global-set-key (kbd "C-a") 'siren-move-beginning-of-line)
(provide 'siren-move-beginning-of-line)
;;; siren-move-beginning-of-line.el ends here

View File

@@ -0,0 +1,21 @@
;;; siren-scroll-half-screen.el --- jimeh's Emacs Siren: scroll-half-screen.
;;; Commentary:
;; Scroll up/down M-v/C-v half a screen instead of a full screen.
;;; Code:
;; Scroll half a screen when using scroll-up and scroll-down functions.
(defadvice scroll-up (around half-window activate)
(setq next-screen-context-lines
(max 1 (/ (1- (window-height (selected-window))) 2)))
ad-do-it)
(defadvice scroll-down (around half-window activate)
(setq next-screen-context-lines
(max 1 (/ (1- (window-height (selected-window))) 2)))
ad-do-it)
(provide 'siren-scroll-half-screen)
;;; siren-scroll-half-screen.el ends here

View File

@@ -0,0 +1,23 @@
;;; siren-swiper.el --- jimeh's Emacs Siren: swiper configuration.
;;; Commentary:
;; Basic configuration for swiper.
;;; Code:
(use-package swiper
:bind
("C-s" . swiper)
("C-c C-r" . ivy-resume)
:config
(ivy-mode 1)
(setq ivy-use-virtual-buffers t)
(custom-set-faces
'(ivy-current-match ((t (:background "#7e9fc9" :foreground "black"))))
'(swiper-line-face ((t (:background "#313c4d"))))))
(provide 'siren-swiper)
;;; siren-swiper.el ends here