(when (maybe-require-package 'ledger-mode)

  (add-to-list 'auto-mode-alist '("\\.ledger$" . ledger-mode))

  (when (maybe-require-package 'flycheck-ledger)
    (after-load 'flycheck
      (after-load 'ledger-mode
        (require 'flycheck-ledger))))

  (after-load 'ledger-mode
    (define-key ledger-mode-map (kbd "RET") 'newline)
    (define-key ledger-mode-map (kbd "C-o") 'open-line))

  (setq ledger-highlight-xact-under-point nil
        ledger-use-iso-dates nil)

  (after-load 'ledger-mode
    (when (memq window-system '(mac ns))
      (exec-path-from-shell-copy-env "LEDGER_FILE")))

  (add-hook 'ledger-mode-hook 'goto-address-prog-mode))

(provide 'init-ledger)

(when (maybe-require-package 'ledger-mode)
  (when (maybe-require-package 'flycheck-ledger)
    (after-load 'flycheck
      (after-load 'ledger-mode
        (require 'flycheck-ledger))))

  (after-load 'ledger-mode
    (define-key ledger-mode-map (kbd "RET") 'newline)
    (define-key ledger-mode-map (kbd "C-o") 'open-line))

  (setq ledger-highlight-xact-under-point nil
        ledger-use-iso-dates nil)

  (after-load 'ledger-mode
    (when (memq window-system '(mac ns))
      (exec-path-from-shell-copy-env "LEDGER_FILE")))

  (add-hook 'ledger-mode-hook 'goto-address-prog-mode))

(provide 'init-ledger)

Drop auto-mode-alist entry for ledger-mode, now added upstream


;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")

((c-mode . ((flycheck-clang-include-path . (
                                            "./lib/include"
                                            "./main/include"
                                             )))))

;;; Directory Local Variables
;;; For more information see (info "(emacs) Directory Variables")

((c-mode . ((flycheck-clang-include-path . (
                                            "./lib/include"
                                            "./main/include"
                                            "./tests/include"
                                             )))))

Add tests include dir to dir locals

Add tests include dir to dir locals


;; -*- no-byte-compile: t; -*-

(package! bison-mode)
(package! vimrc-mode)
(package! ripgrep)
(package! alloy-mode
  :recipe (:host github :repo "dwwmmn/alloy-mode"))
(package! org-ref)

(package! evil-snipe :disable t)

;; -*- no-byte-compile: t; -*-

(package! bison-mode)
(package! vimrc-mode)
(package! ripgrep)
(package! alloy-mode
  :recipe (:host github :repo "dwwmmn/alloy-mode"))
(package! org-ref)
(package! fill-column-indicator)

(package! evil-snipe :disable t)

Add fill-column-indicator package to emacs


(defun ruby-eval-buffer () (interactive)
   "Evaluate the buffer with ruby."
   (shell-command-on-region (point-min) (point-max) "ruby -w "))

(defun clgc-ruby-mode-hook ()
  (require 'rinari)
  (setq rinari-tags-file-name "TAGS")
  (global-rinari-mode t))

(add-hook 'ruby-mode-hook 'clgc-ruby-mode-hook)
(add-hook 'ruby-mode-hook 'superword-mode)
(add-hook 'ruby-mode-hook 'projectile-rails-on)

;; inf-ruby
(add-hook 'after-init-hook 'inf-ruby-switch-setup)

;; Robe
(add-hook 'ruby-mode-hook 'robe-mode)

;; (eval-after-load 'company
;;   '(add-to-list 'company-backends 'company-robe))

(defadvice inf-ruby-console-auto (before activate-rvm-for-robe activate)
  (rvm-activate-corresponding-ruby))

;; RVM
(add-hook 'after-init-hook 'rvm-use-default)

(eval-after-load 'rspec-mode
  '(rspec-install-snippets))

(defun rinari-rake-migrate-up ()
  (interactive)
  (rinari-rake "db:migrate"))

(provide 'clgc-ruby)

(defun ruby-eval-buffer () (interactive)
   "Evaluate the buffer with ruby."
   (shell-command-on-region (point-min) (point-max) "ruby -w "))

(defun clgc-ruby-mode-hook ()
  (require 'rinari)
  (setq rinari-tags-file-name "TAGS")
  (setq ruby-insert-encoding-magic-comment nil)
  (setq ruby-align-to-stmt-keywords '(def if case))
  (global-rinari-mode t))

(add-hook 'ruby-mode-hook 'clgc-ruby-mode-hook)
(add-hook 'ruby-mode-hook 'superword-mode)
(add-hook 'ruby-mode-hook 'projectile-rails-on)

;; inf-ruby
(add-hook 'after-init-hook 'inf-ruby-switch-setup)

;; Robe
(add-hook 'ruby-mode-hook 'robe-mode)

;; (eval-after-load 'company
;;   '(add-to-list 'company-backends 'company-robe))

(defadvice inf-ruby-console-auto (before activate-rvm-for-robe activate)
  (rvm-activate-corresponding-ruby))

;; RVM
(add-hook 'after-init-hook 'rvm-use-default)

(eval-after-load 'rspec-mode
  '(rspec-install-snippets))

(defun rinari-rake-migrate-up ()
  (interactive)
  (rinari-rake "db:migrate"))

(provide 'clgc-ruby)

Change the indentation rules and stop inserting magic UTF in ruby-mode


;; -*- lexical-binding: t -*-

(defconst my-evil-packages '(evil
                             (evil-escape :excluded t)
                             evil-nerd-commenter))

(defun my-evil/post-init-evil ()
  ;; Do not move cursor back when exiting insert mode, and allow the cursor to
  ;; go past the last character of the line. This is more in line with default
  ;; Emacs behavior and feels more natural to me.
  (setq evil-move-cursor-back nil
        evil-move-beyond-eol t))

(defun my-evil/post-init-evil-nerd-commenter ()
  ;; Register text object for comments.
  (autoload 'evilnc-inner-comment "evil-nerd-commenter-operator")
  (define-key evil-inner-text-objects-map "c" #'evilnc-inner-comment)
  (autoload 'evilnc-outer-commenter "evil-nerd-commenter-operator")
  (define-key evil-outer-text-objects-map "c" #'evilnc-outer-commenter))

;; -*- lexical-binding: t -*-

(defconst my-evil-packages '(drag-stuff
                             evil
                             (evil-escape :excluded t)
                             evil-nerd-commenter))

(defun my-evil/init-drag-stuff ()
  (use-package drag-stuff
    :defer t
    :init
    (with-eval-after-load 'evil-maps
      (define-key evil-visual-state-map "J" #'drag-stuff-down)
      (define-key evil-visual-state-map "K" #'drag-stuff-up))))

(defun my-evil/post-init-evil ()
  ;; Do not move cursor back when exiting insert mode, and allow the cursor to
  ;; go past the last character of the line. This is more in line with default
  ;; Emacs behavior and feels more natural to me.
  (setq evil-move-cursor-back nil
        evil-move-beyond-eol t))

(defun my-evil/post-init-evil-nerd-commenter ()
  ;; Register text object for comments.
  (autoload 'evilnc-inner-comment "evil-nerd-commenter-operator")
  (define-key evil-inner-text-objects-map "c" #'evilnc-inner-comment)
  (autoload 'evilnc-outer-commenter "evil-nerd-commenter-operator")
  (define-key evil-outer-text-objects-map "c" #'evilnc-outer-commenter))

Use K/J to drag lines up and down in visual state


(require 'init-clojure)

(when (maybe-require-package 'cider)
  (setq nrepl-popup-stacktraces nil)

  (after-load 'cider
    (add-hook 'cider-mode-hook 'eldoc-mode)
    (add-hook 'cider-repl-mode-hook 'subword-mode)
    (add-hook 'cider-repl-mode-hook 'paredit-mode)

    ;; nrepl isn't based on comint
    (add-hook 'cider-repl-mode-hook 'sanityinc/no-trailing-whitespace))

  (require-package 'flycheck-clojure)
  (after-load 'clojure-mode
    (after-load 'flycheck
      (flycheck-clojure-setup))))

(provide 'init-clojure-cider)

(require 'init-clojure)

(when (maybe-require-package 'cider)
  (setq nrepl-popup-stacktraces nil)

  (after-load 'cider
    (add-hook 'cider-mode-hook 'eldoc-mode)
    (add-hook 'cider-repl-mode-hook 'subword-mode)
    (add-hook 'cider-repl-mode-hook 'paredit-mode)

    ;; nrepl isn't based on comint
    (add-hook 'cider-repl-mode-hook 'sanityinc/no-trailing-whitespace))

  (require-package 'flycheck-clojure)
  (after-load 'clojure-mode
    (after-load 'cider
      (after-load 'flycheck
        (flycheck-clojure-setup)))))

(provide 'init-clojure-cider)

Load flycheck-clojure only after loading cider

Fixes #502, thanks @picong


(when (maybe-require-package 'rinari)
  (after-load 'rinari
    (diminish 'rinari-minor-mode "Rin"))
  (global-rinari-mode))

(defun update-rails-ctags ()
  (interactive)
  (let ((default-directory (or (rinari-root) default-directory)))
    (shell-command (concat "ctags -a -e -f " rinari-tags-file-name " --tag-relative -R app lib vendor test"))))

(when (maybe-require-package 'projectile-rails)
  (after-load 'projectile
    (add-hook 'projectile-mode-hook 'projectile-rails-on)
    (after-load 'guide-key
      (add-to-list 'guide-key/guide-key-sequence "C-c r"))))

(provide 'init-rails)

Drop rinari for Rails work: projectile-rails is sufficient


;;; pastebin.el --- pastebin example with simple-httpd

(require 'cl)
(require 'url-util)
(require 'simple-httpd)

(defvar pastebin-data-root (file-name-directory load-file-name))

(defvar pastebin-db (make-hash-table))

(defun pastebin-get-file (file)
  (with-temp-buffer
    (insert-file-literally (expand-file-name file pastebin-data-root))
    (buffer-string)))

(defservlet pastebin text/html (path)
  (let* ((id (string-to-number (file-name-nondirectory path)))
         (content (url-insert-entities-in-string (gethash id pastebin-db ""))))
    (insert (format (pastebin-get-file "paste.html") content))))

(defun httpd/pastebin/post (proc path query request)
  (let* ((id (random most-positive-fixnum))
         (content (cadr (assoc "Content" request)))
         (decode (url-unhex-string (substitute ?  ?+ content) t)))
    (puthash id (substring decode 2) pastebin-db)
    (httpd-redirect proc (format "/pastebin/%d" id))))

;;; pastebin.el --- pastebin example with simple-httpd

(require 'cl)
(require 'url-util)
(require 'simple-httpd)

(defvar pastebin-data-root (file-name-directory load-file-name))

(defvar pastebin-db (make-hash-table))

(defun pastebin-get-file (file)
  (with-temp-buffer
    (insert-file-literally (expand-file-name file pastebin-data-root))
    (buffer-string)))

(defservlet pastebin text/html (path)
  (let* ((id (string-to-number (file-name-nondirectory path) 16))
         (content (url-insert-entities-in-string (gethash id pastebin-db ""))))
    (insert (format (pastebin-get-file "paste.html") content))))

(defun httpd/pastebin/post (proc path query request)
  (let* ((id (random most-positive-fixnum))
         (content (cadr (assoc "Content" request)))
         (decode (url-unhex-string (substitute ?  ?+ content) t)))
    (puthash id (substring decode 2) pastebin-db)
    (httpd-redirect proc (format "/pastebin/%x" id))))

Put IDs in base 16.

Put IDs in base 16.


(setq user-init-file "/tmp/.emacs")

;; Marmalade: http://marmalade-repo.org/
(require 'package)
(add-to-list 'package-archives
    '("marmalade" .
      "http://marmalade-repo.org/packages/"))
(package-initialize)

(package-refresh-contents)

(package-install 'color-theme)
(package-install 'gh)
(package-install 'gist)
(package-install 'paredit)
(package-install 'ruby-mode)
(package-install 'smex)
(package-install 'typopunct)
(package-install 'dash)

(setq user-init-file "/tmp/.emacs")

;; Marmalade: http://marmalade-repo.org/
(require 'package)
(add-to-list 'package-archives
    '("marmalade" .
      "http://marmalade-repo.org/packages/"))
(package-initialize)

(package-refresh-contents)

(package-install 'color-theme)
(package-install 'gh)
(package-install 'gist)
(package-install 'pkg-info)
(package-install 'paredit)
(package-install 'ruby-mode)
(package-install 'smex)
(package-install 'typopunct)
(package-install 'dash)

Emacs: Add pkg-info package (depended on by nrepl.el)


(add-hook
 'ruby-mode-hook
 (lambda ()
   ;; Check spelling.
   (flyspell-prog-mode)
   ;; Don't autofill
   (auto-fill-mode 0)
   ;; Make enter indent.
   (local-set-key (kbd "C-m") 'reindent-then-newline-and-indent)
   ;; Clean up whitespace on save.
   (add-hook 'before-save-hook 'whitespace-cleanup nil t)
   ;; Rebuild tags on save.
   (add-hook (make-local-variable 'after-save-hook) 'rebuild-tags nil t)
   ;; Disable rubocop
   (defvar flycheck-disabled-checkers "flycheck.el")
   (setq flycheck-disabled-checkers
         (cons 'ruby-rubocop flycheck-disabled-checkers))
   ;; Make do/end less prominent.
   (defvar paren-face-regexp)
   (setq-local paren-face-regexp "\\(^\\|[[:space:]]\\)\\(do\\|end\\)\\b")))

(add-hook
 'ruby-mode-hook
 (lambda ()
   ;; Check spelling.
   (flyspell-prog-mode)
   ;; Don't autofill
   (auto-fill-mode 0)
   ;; Make enter indent.
   (local-set-key (kbd "C-m") 'reindent-then-newline-and-indent)
   ;; Clean up whitespace on save.
   (add-hook 'before-save-hook 'whitespace-cleanup nil t)
   ;; Rebuild tags on save.
   (add-hook (make-local-variable 'after-save-hook) 'rebuild-tags nil t)
   ;; Disable rubocop
   (defvar flycheck-disabled-checkers "flycheck.el")
   (setq flycheck-disabled-checkers
         (cons 'ruby-rubocop flycheck-disabled-checkers))
   ;; Turn on subword-mode
   (require 'diminish)
   (subword-mode 1)
   (diminish 'subword-mode)
   ;; Make do/end less prominent.
   (defvar paren-face-regexp)
   (setq-local paren-face-regexp
               (rx symbol-start (or "do" "end") symbol-end))))

Switch over to using Elixir `end` highlighting pattern


(require 'package)

(defvar marmalade '("marmalade" . "http://marmalade-repo.org/packages/"))
(defvar gnu '("gnu" . "http://elpa.gnu.org/packages/"))
(defvar melpa '("melpa" . "http://melpa.milkbox.net/packages/"))

;; Add marmalade to package repos
(add-to-list 'package-archives marmalade)
(add-to-list 'package-archives melpa t)

(package-initialize)

(defun packages-install (&rest packages)
  (mapc (lambda (package)
          (let ((name (car package))
                (repo (cdr package)))
            (when (not (package-installed-p name))
              (let ((package-archives (list repo)))
                (package-initialize)
                (package-install name)))))
        packages)
  (package-initialize))

(provide 'setup-package)

(require 'package)

(defvar marmalade '("marmalade" . "http://marmalade-repo.org/packages/"))
(defvar gnu '("gnu" . "http://elpa.gnu.org/packages/"))
(defvar melpa '("melpa" . "http://melpa.milkbox.net/packages/"))

;; Add marmalade to package repos
(add-to-list 'package-archives marmalade)
(add-to-list 'package-archives melpa t)

(package-initialize)

(unless (file-exists-p "~/.emacs.d/elpa/archives")
  (package-refresh-contents))

(defun packages-install (&rest packages)
  (mapc (lambda (package)
          (let ((name (car package))
                (repo (cdr package)))
            (when (not (package-installed-p name))
              (let ((package-archives (list repo)))
                (package-initialize)
                (package-install name)))))
        packages)
  (package-initialize)
  (delete-other-windows))

(provide 'setup-package)

Make sure to fetch package-lists if needed.


;; Use C-f during file selection to switch to regular find-file
(ido-mode t)  ; use 'buffer rather than t to use only buffer switching
(ido-everywhere t)
(setq ido-enable-flex-matching t)
(setq ido-use-filename-at-point nil)
(setq ido-auto-merge-work-directories-length 0)

;; Allow the same buffer to be open in different frames
(setq ido-default-buffer-method 'selected-window)

(defun steve-ido-choose-from-recentf ()
  "Use ido to select a recently opened file from the `recentf-list'"
  (interactive)
  (find-file (ido-completing-read "Open file: " recentf-list nil t)))
(global-set-key [(meta f11)] 'steve-ido-choose-from-recentf)

;;----------------------------------------------------------------------------
;; ido completion in M-x
;;----------------------------------------------------------------------------
(require 'smex)
(smex-initialize)
(global-set-key "\M-x" 'smex)

(provide 'init-ido)

;; Use C-f during file selection to switch to regular find-file
(ido-mode t)  ; use 'buffer rather than t to use only buffer switching
(ido-everywhere t)
(setq ido-enable-flex-matching t)
(setq ido-use-filename-at-point nil)
(setq ido-auto-merge-work-directories-length 0)
(setq ido-show-dot-for-dired t)

;; Allow the same buffer to be open in different frames
(setq ido-default-buffer-method 'selected-window)

(defun steve-ido-choose-from-recentf ()
  "Use ido to select a recently opened file from the `recentf-list'"
  (interactive)
  (find-file (ido-completing-read "Open file: " recentf-list nil t)))
(global-set-key [(meta f11)] 'steve-ido-choose-from-recentf)

;;----------------------------------------------------------------------------
;; ido completion in M-x
;;----------------------------------------------------------------------------
(require 'smex)
(smex-initialize)
(global-set-key "\M-x" 'smex)

(provide 'init-ido)

Include '.' in ido file completion lists, allowing quick switch to dired


(require-package 'sql-indent)
(eval-after-load 'sql
  '(load-library "sql-indent"))

(eval-after-load 'sql
  '(when (featurep 'dash-at-point)
     (defun sanityinc/maybe-set-dash-db-docset ()
       (when (eq sql-product 'postgres)
         (setq dash-at-point-docset "psql")))

     (add-hook 'sql-mode-hook 'sanityinc/maybe-set-dash-db-docset)
     (add-hook 'sql-interactive-mode-hook 'sanityinc/maybe-set-dash-db-docset)
     (defadvice sql-set-product (after set-dash-docset activate)
       (sanityinc/maybe-set-dash-db-docset))))

(provide 'init-sql)

(require-package 'sql-indent)
(eval-after-load 'sql
  '(load-library "sql-indent"))

(eval-after-load 'sql
  '(when (package-installed-p 'dash-at-point)
     (defun sanityinc/maybe-set-dash-db-docset ()
        (when (eq sql-product 'postgres)
          (setq dash-at-point-docset "psql")))

     (add-hook 'sql-mode-hook 'sanityinc/maybe-set-dash-db-docset)
     (add-hook 'sql-interactive-mode-hook 'sanityinc/maybe-set-dash-db-docset)
     (defadvice sql-set-product (after set-dash-docset activate)
       (sanityinc/maybe-set-dash-db-docset))))

(provide 'init-sql)

Use package-installed-p to detect dash-at-point


(require 'todochiku) ;; growl notifications when compilation finishes
(setq todochiku-icons-directory (expand-file-name "~/.emacs.d/site-lisp/todochiku-icons"))

;;----------------------------------------------------------------------------
;; Use terminal-notifier in OS X Mountain Lion
;; https://github.com/alloy/terminal-notifier (Install in /Applications)
;;----------------------------------------------------------------------------
(setq terminal-notifier-path
      "/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier")

(defadvice todochiku-get-arguments (around todochiku-nc)
  (setq ad-return-value
        (list "-title" title "-message" message "-activate" "org.gnu.Emacs")))

(when (file-executable-p terminal-notifier-path)
  (setq todochiku-command terminal-notifier-path)
  (ad-activate 'todochiku-get-arguments))

(provide 'init-growl)

(require 'todochiku) ;; growl notifications when compilation finishes
(setq todochiku-icons-directory (expand-file-name "~/.emacs.d/site-lisp/todochiku-icons"))

(defcustom terminal-notifier-path
  "/Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier"
  "Path to the terminal-notifier app for Mountain Lion, if installed.
See https://github.com/alloy/terminal-notifier for more information.")

(when (and *is-a-mac* (file-executable-p terminal-notifier-path))
  (defadvice todochiku-get-arguments (around todochiku-terminal-notifier activate)
    (setq ad-return-value
          (list "-title" title "-message" message "-activate" "org.gnu.Emacs")))
  (setq todochiku-command terminal-notifier-path))

(provide 'init-growl)

Tidy up terminal-notifier code, and skip file test when not on OS X


(server-start)

;; make C-x k work for emacsclient sessions too.
(add-hook 'server-switch-hook
  (lambda ()
    (when server-buffer-clients
      (local-set-key (kbd "C-x k") 'server-edit)
     )
   )
 )

(server-start)

(defun my/kill-buffer-or-server-edit ()
  (interactive)
  (if server-buffer-clients
      (server-edit)
    (kill-buffer)
   )
 )

;; make C-x k work for emacsclient sessions too.
(add-hook 'server-switch-hook
  (lambda ()
    (local-set-key (kbd "C-x k") 'my/kill-buffer-or-server-edit)
   )
 )

Fix handling of C-x k.

Fix handling of C-x k.


(when *is-a-mac*
  (setq mac-command-modifier 'meta)
  (setq mac-option-modifier 'meta)
  (setq default-input-method "MacOSX")
  ;; Make mouse wheel / trackpad scrolling less jerky
  (setq mouse-wheel-scroll-amount '(1
                                    ((shift) . 5)
                                    ((control))))
  (dolist (multiple '("" "double-" "triple-"))
    (dolist (direction '("right" "left"))
      (global-set-key (kbd (concat "<" multiple "wheel-" direction ">")) 'ignore)))
  (global-set-key (kbd "M-`") 'ns-next-frame)
  (global-set-key (kbd "M-h") 'ns-do-hide-emacs)
  (global-set-key (kbd "M-˙") 'ns-do-hide-others)
  (after-load 'nxml-mode
    (define-key nxml-mode-map (kbd "M-h") nil))
  (global-set-key (kbd "M-ˍ") 'ns-do-hide-others) ;; what describe-key reports for cmd-option-h
  )

(provide 'init-osx-keys)

(when *is-a-mac*
  (setq mac-command-modifier 'meta)
  (setq mac-option-modifier 'none)
  (setq default-input-method "MacOSX")
  ;; Make mouse wheel / trackpad scrolling less jerky
  (setq mouse-wheel-scroll-amount '(1
                                    ((shift) . 5)
                                    ((control))))
  (dolist (multiple '("" "double-" "triple-"))
    (dolist (direction '("right" "left"))
      (global-set-key (kbd (concat "<" multiple "wheel-" direction ">")) 'ignore)))
  (global-set-key (kbd "M-`") 'ns-next-frame)
  (global-set-key (kbd "M-h") 'ns-do-hide-emacs)
  (global-set-key (kbd "M-˙") 'ns-do-hide-others)
  (after-load 'nxml-mode
    (define-key nxml-mode-map (kbd "M-h") nil))
  (global-set-key (kbd "M-ˍ") 'ns-do-hide-others) ;; what describe-key reports for cmd-option-h
  )

(provide 'init-osx-keys)

Change meta key to none

Change meta key to none


;;; switch-window-conf.el -- Settings for switch-window.
(eval-when-compile
  (require 'switch-window))

(custom-set-variables
 '(switch-window-shortcut-style 'qwerty)
 '(switch-window-increase 8)
 '(switch-window-timeout 5)
 '(switch-window-threshold 2)
 '(switch-window-preferred 'ivy)
 '(switch-window-configuration-change-hook-inhibit t))

;;; switch-window-conf.el ends here

;;; switch-window-conf.el -- Settings for switch-window.
;;
;;; Commentary:
;;
;;; Code:
(require 'switch-window)

(custom-set-variables
 '(switch-window-shortcut-style 'qwerty)
 '(switch-window-minibuffer-shortcut ?z)
 '(switch-window-timeout 5)
 '(switch-window-threshold 2)
 '(switch-window-preferred 'ivy)
 '(switch-window-configuration-change-hook-inhibit t)
 '(switch-window-input-style 'minibuffer))

;;; switch-window-conf.el ends here

Update settings to better support EXWM

switch-window: Update settings to better support EXWM


(require 'region-bindings-mode)
(require 'multiple-cursors)

(region-bindings-mode-enable)

(bind-keys :map region-bindings-mode-map
           ("p" . previous-line)
           ("e" . end-of-line)
           ("a" . beginning-of-line)
           ("w" . forward-word)
           ("b" . backward-word)
           ("a" . mc/mark-all-like-this)
           ("n" . mc/mark-next-like-this)
           ("l" . mc/edit-lines))

(add-to-list 'region-bindings-mode-disable-predicates
             'minibufferp)

(require 'region-bindings-mode)
(require 'multiple-cursors)

(region-bindings-mode-enable)

(bind-keys :map region-bindings-mode-map
           ("l" . mc/edit-lines)
           ("w" . count-words-region)
           ("u" . upcase-region)
           ("d" . downcase-region)
           ("m" . apply-macro-to-region-lines)
           ("C" . my-duplicate-line-or-region)
           (";" . my-comment-line-or-region)
           ("SPC" . exchange-point-and-mark)

           ("a" . mc/mark-all-like-this)
           ("n" . mc/mark-next-like-this)
           )

(add-to-list 'region-bindings-mode-disable-predicates
             'minibufferp)

Add keys when region is active

Add keys when region is active


;; -*- no-byte-compile: t; -*-
;;; lang/scala/packages.el

(package! sbt-mode :pin "633a315ad4")
(package! scala-mode :pin "46bb948345")

(when (featurep! +lsp)
    (package! lsp-metals :pin "5468b638cd81b7d9ce9edc652c281b28bd775c23"))

Add separate package for lsp-metals

Add separate package for lsp-metals

lsp-metals was extracted out of lsp-emacs into a separate package. This
change adds that separate package to the scala module when the lsp
feature is selected.

Fixes hlissner/doom-emacs#3362


;;; ar-shell.el --- Shell support.

;;; Commentary:
;; Shell helpers.

(require 'comint)

(defun ar/shell-cd (dir-path)
  "Change shell current working directory to DIR-PATH.

Like shell-pop--cd-to-cwd-shell, but without recentering."
  (unless (string-equal mode-name "Shell")
    (error "Not in Shell mode"))
  (message mode-name)
  (goto-char (point-max))
  (comint-kill-input)
  (insert (concat "cd " (shell-quote-argument dir-path)))
  (let ((comint-process-echoes t))
    (comint-send-input)))

(provide 'ar-shell)

;;; ar-shell.el ends here

;;; ar-shell.el --- Shell support.

;;; Commentary:
;; Shell helpers.

(require 'comint)

(defun ar/shell-cd (dir-path)
  "Change shell current working directory to DIR-PATH.

Like shell-pop--cd-to-cwd-shell, but without recentering."
  (unless (string-equal mode-name "Shell")
    (error "Not in Shell mode"))
  (message mode-name)
  (goto-char (point-max))
  (comint-kill-input)
  (insert (concat "cd " (shell-quote-argument dir-path)))
  (let ((comint-process-echoes t))
    (comint-send-input)))

(defun ar/shell-send-command (command)
  "Send COMMAND to shell mode."
  (assert (string-equal mode-name "Shell") nil "Not in Shell mode")
  (message mode-name)
  (goto-char (point-max))
  (comint-kill-input)
  (insert command)
  (let ((comint-process-echoes t))
    (comint-send-input)))

(provide 'ar-shell)

;;; ar-shell.el ends here

Send command to shell mode

Send command to shell mode


;;; init.el -*- lexical-binding: t; -*-

(doom!
 :completion
 ivy
 (company +auto)

 :ui
 doom
 modeline
 ophints
 hl-todo
 nav-flash
 neotree
 (popup +all +defaults)
 (pretty-code +fira)
 vc-gutter
 vi-tilde-fringe
 window-select

 :editor
 (evil +everywhere +commands)
 snippets
 file-templates
 multiple-cursors
 rotate-text
 fold

 :emacs
 (dired +icons)
 electric
 vc

 :tools
 (lookup +docsets)
 eval
 make
 magit
 lsp
 editorconfig
 flyspell
 flycheck

 :lang
 (sh +fish)
 emacs-lisp
 markdown
 (csharp +unity)
 (haskell +dante)
 (org
  +attach
  +babel
  +export
  +present)
 (cc +lsp)
 ocaml
 idris

 :term
 term
 eshell

 :app
 ;;(email +gmail)    ; emacs as an email client
 ;;(rss +org)        ; emacs as an RSS reader
 ;;(write            ; emacs as a word processor (latex + org + markdown)
 ;; +wordnut         ; wordnet (wn) search
 ;; +langtool)       ; a proofreader (grammar/style check) for Emacs

 :collab
 ;;floobits          ; peer programming for a price
 ;;impatient-mode    ; show off code over HTTP

 :config
 (default)
 ;;literate
 )

;;; init.el -*- lexical-binding: t; -*-

(doom!
 :completion
 ivy
 (company +auto)

 :ui
 doom
 modeline
 ophints
 hl-todo
 nav-flash
 neotree
 (popup +all +defaults)
 (pretty-code +fira)
 vc-gutter
 vi-tilde-fringe
 window-select

 :editor
 (evil +everywhere +commands)
 snippets
 file-templates
 multiple-cursors
 rotate-text
 fold

 :emacs
 (dired +icons)
 electric
 vc

 :tools
 (lookup +docsets)
 eval
 make
 magit
 lsp
 editorconfig
 flyspell
 flycheck

 :lang
 (sh +fish)
 emacs-lisp
 markdown
 (csharp +unity)
 (haskell +lsp)
 (org
  +attach
  +babel
  +export
  +present)
 (cc +lsp)
 ocaml
 idris

 :term
 term
 eshell

 :app
 ;;(email +gmail)    ; emacs as an email client
 ;;(rss +org)        ; emacs as an RSS reader
 ;;(write            ; emacs as a word processor (latex + org + markdown)
 ;; +wordnut         ; wordnet (wn) search
 ;; +langtool)       ; a proofreader (grammar/style check) for Emacs

 :collab
 ;;floobits          ; peer programming for a price
 ;;impatient-mode    ; show off code over HTTP

 :config
 (default)
 ;;literate
 )

Switch back to lsp for haskell in emacs

Switch back to lsp for haskell in emacs


;; linum-relative: Vim-like relative line numbers
;; https://github.com/coldnew/linum-relative
(use-package linum-relative
  :ensure linum-relative
  :init
  (linum-relative-global-mode 1))

;; Disable the intro screen & message
(setq inhibit-splash-screen t
      inhibit-startup-echo-area-message t
      inhibit-startup-message t)

;; Sane line wrapping
(visual-line-mode 1)

;; Always trail newline
(setq require-final-newline t)

;; Disable the toolbar
(tool-bar-mode -1)

(provide 'my-lookfeel)

;; linum-relative: Vim-like relative line numbers
;; https://github.com/coldnew/linum-relative
(use-package linum-relative
  :ensure linum-relative
  :init
  (linum-relative-global-mode 1))

;; atom-one-dark-theme: An Emacs port of the Atom One Dark theme from Atom.io.
;; https://github.com/jonathanchu/atom-one-dark-theme
(use-package atom-one-dark-theme
  :ensure atom-one-dark-theme
  :config
  (progn
    (unless noninteractive
      (load-theme 'atom-one-dark t))))

;; Disable the intro screen & message
(setq inhibit-splash-screen t
      inhibit-startup-echo-area-message t
      inhibit-startup-message t)

;; Sane line wrapping
(visual-line-mode 1)

;; Always trail newline
(setq require-final-newline t)

;; Disable the toolbar
(tool-bar-mode -1)

(provide 'my-lookfeel)

Add atom-one-dark-theme package to Emacs

Change colourscheme to look like that of the Atom editor.


;; Emacs configuration

;; Parameters for eshell.

;; Make eshell open in a new window instead of replacing the current buffer in
;; the current window.
(setq-default display-buffer-alist '(("\\`\\*e?shell" display-buffer-pop-up-window)))

;; Set eshell data directory and alias file.
(setq-default eshell-directory-name "~/.emacs.d/eshell")
(setq-default eshell-aliases-file "~/.emacs.d/eshell/aliases")

;; Emacs configuration

;; Parameters for eshell.

;; Make eshell open in a new window instead of replacing the current buffer in
;; the current window.
(setq-default display-buffer-alist '(("\\`\\*e?shell" display-buffer-pop-up-window)))

;; Set eshell data directory and alias file.
(setq-default eshell-directory-name "~/.emacs.d/eshell"
              eshell-aliases-file "~/.emacs.d/eshell/aliases")

Use less calls to setq-default

Use less calls to setq-default


(use-package lsp-mode
  :config
  ;; For some reason icons aren't currently rendering, so don't show them.
  (setq lsp-modeline-code-actions-segments '(count name))

  (setq lsp-rust-analyzer-cargo-watch-command "clippy")
  (setq lsp-rust-clippy-preference "on")

  (set-face-attribute 'lsp-lsp-flycheck-warning-unnecessary-face nil :foreground nil)

  ;; Don't override my navigation bindings.
  (define-key lsp-signature-mode-map (kbd "M-n") nil)
  (define-key lsp-signature-mode-map (kbd "M-p") nil)

  (define-key lsp-mode-map (kbd "C-c f") #'lsp-format-buffer)
  (define-key lsp-mode-map (kbd "C-c r") #'lsp-rename)

  (add-hook 'rust-mode-hook #'lsp-mode))

(provide 'lsp-customisations)

(use-package lsp-mode
  :config
  ;; For some reason icons aren't currently rendering, so don't show them.
  (setq lsp-modeline-code-actions-segments '(count name))

  (setq lsp-rust-analyzer-cargo-watch-command "clippy")
  (setq lsp-rust-clippy-preference "on")

  (set-face-attribute 'lsp-lsp-flycheck-warning-unnecessary-face nil :foreground nil)

  ;; Don't override my navigation bindings.
  (define-key lsp-signature-mode-map (kbd "M-n") nil)
  (define-key lsp-signature-mode-map (kbd "M-p") nil)

  (define-key lsp-mode-map (kbd "C-c f") #'lsp-format-buffer)
  (define-key lsp-mode-map (kbd "C-c r") #'lsp-rename)
  ;; Mnemonic: show references in Xref.
  (define-key lsp-mode-map (kbd "C-c x") #'lsp-find-references)

  (add-hook 'rust-mode-hook #'lsp-mode))

(provide 'lsp-customisations)

Add keybinding for xref in LSP

Add keybinding for xref in LSP


(use-package spacemacs-theme
  :defer t
  :init
  (setq default-frame-alist (quote ((fullscreen . maximized))))
  (load-theme 'spacemacs-dark t)
  )

(use-package spaceline
  :defer t
  :init
  (setq powerline-default-separator 'arrow-fade)
  )

(use-package spaceline-config
  :demand t
  :ensure spaceline
  :config
  (spaceline-define-segment line-column
    "The current line and column numbers."
    "l:%l c:%2c")
  (spaceline-helm-mode 1)
  (spaceline-spacemacs-theme)
  )

(provide 'setup-theme)

(use-package spacemacs-theme
  :defer t
  :init
  (setq default-frame-alist (quote ((fullscreen . maximized))))
  (load-theme 'spacemacs-dark t)
  )

(use-package spaceline
  :defer t
  :init
  (setq powerline-default-separator 'slant)
  (setq ns-use-srgb-colorspace nil)
  (setq powerline-height 15)
  )

(use-package spaceline-config
  :demand t
  :ensure spaceline
  :config
  (spaceline-define-segment line-column
    "The current line and column numbers."
    "l:%l c:%2c")
  (spaceline-helm-mode 1)
  (spaceline-spacemacs-theme)
  )

(provide 'setup-theme)

Disable srgb colorspace and set powerline-height to 15


(use-package smartparens-config
  :commands smartparens-mode
  :init
  (add-to-hooks 'smartparens-mode '(prog-mode-hook
                                    erlang-mode-hook
                                    )))

(use-package smartparens-config
  :commands smartparens-mode
  :init
  (add-to-hooks 'smartparens-mode '(erlang-mode-hook
                                    markdown-mode-hook
                                    prog-mode-hook
                                    )))

Add smartparens to markdown mode hook

Add smartparens to markdown mode hook


;; Time-stamp: <2016-02-05 16:30:43 kmodi>

;; Git Link
;; https://github.com/sshaw/git-link

(use-package git-link
  :bind (:map region-bindings-mode-map
         ("g" . modi/git-link-force-hash))
  :config
  (progn
    (defun modi/git-link-force-hash ()
      "This function is the same as `git-link' except that it copies the link
with the commit hash in the link even if branch name is available."
      (interactive)
      (let ((git-link-use-commit t))
        (call-interactively 'git-link)))))

(provide 'setup-git-link)

;; Time-stamp: <2016-02-17 11:00:18 kmodi>

;; Git Link
;; https://github.com/sshaw/git-link

(use-package git-link
  :bind (:map region-bindings-mode-map
         ("g" . modi/git-link-force-hash))
  :config
  (progn
    (defun modi/git-link-force-hash ()
      "This function is the same as `git-link' except that it copies the link
with the commit hash in the link even if branch name is available."
      (interactive)
      (let ((git-link-use-commit t))
        (call-interactively 'git-link)))

    ;; Add support for git.savannah.gnu.org
    (add-to-list 'git-link-remote-alist '("git.savannah.gnu.org" git-link-savannah-gnu))
    (add-to-list 'git-link-commit-remote-alist '("git.savannah.gnu.org" git-link-commit-savannah-gnu))

    (defun git-link-savannah-gnu (hostname dirname filename branch commit start end)
      ;; Example: http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/README?id=d4b93e11a519cf71beca69654fda158d01a26c3b#n1
      (format "http://%s/cgit/%s/tree/%s?id=%s%s"
              hostname
              (replace-regexp-in-string "^r/\\(.*\\)" "\\1.git" dirname)
              filename
              (or branch commit)
              (format "#n%s" start)))

    (defun git-link-commit-savannah-gnu (hostname dirname commit)
      ;; Example: http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=2abcb06cab03cf9040348146fcc0e3e93ae24a58
      (format "http://%s/cgit/%s/commit/?id=%s"
              hostname
              (replace-regexp-in-string "^r/\\(.*\\)" "\\1.git" dirname)
              commit))))

(provide 'setup-git-link)

Add git-link support for emacs source code

- for git.savannah.gnu.org repos


;; Time-stamp: <2016-05-19 21:38:52 kmodi>

;; Paradox
;; https://github.com/Malabarba/paradox

(use-package paradox
  :defer t
  :config
  (progn
    ;; The "paradox-token" file is supposed to contain this line:
    ;;     (setq paradox-github-token "<YOUR_TOKEN>")
    (load (locate-user-emacs-file "paradox-token") :noerror :nomessage)

    (setq paradox-lines-per-entry 1)
    (setq paradox-automatically-star t)

    (paradox-enable)))

(provide 'setup-paradox)

;; Time-stamp: <2017-04-11 17:55:49 kmodi>

;; Paradox
;; https://github.com/Malabarba/paradox

(use-package paradox
  :defer 10
  :config
  (progn
    ;; The "paradox-token" file is supposed to contain this line:
    ;;     (setq paradox-github-token "<YOUR_TOKEN>")
    (load (locate-user-emacs-file "paradox-token") :noerror :nomessage)

    (setq paradox-lines-per-entry 1)
    (setq paradox-automatically-star t)

    (paradox-enable)))

(provide 'setup-paradox)

Load paradox after idle time of 10 seconds


(require 'tempo)
;; (setq tempo-interactive t)

(tempo-define-template "org-digraph"
                       '(> "#+begin_src dot :file " (p "Filename: ") ".png\n"
                           > "digraph G {\n"
                           > "}\n"
                           > "#+end_src\n"))

(provide 'clgc-tempo)

(require 'tempo)
;; (setq tempo-interactive t)

(tempo-define-template "org-digraph"
                       '(> "#+begin_src dot :file " (p "Filename: ") ".png\n"
                           > "digraph G {\n"
                           > "}\n"
                           > "#+end_src\n"))

(define-abbrev org-mode-abbrev-table "dotgraph" "" 'tempo-template-org-digraph)

(provide 'clgc-tempo)

Add an abbrev binding to the digraph template


(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("melpa" . "http://melpa.milkbox.net/packages/")))

;; from http://stackoverflow.com/questions/10092322/how-to-automatically-install-emacs-packages-by-specifying-a-list-of-package-name (Nicolas Dudebout)
;; {{{
(setq package-list '(ace-jump-mode
                     browse-kill-ring
                     auto-complete
                     lua-mode
                     glsl-mode
                     undo-tree
                     fic-mode
                     web-mode
                     php-mode
                     auto-highlight-symbol
                     org
                     isearch-symbol-at-point
                     ido-ubiquitous
                     ido-vertical-mode
                     smex
                     window-number
                     fuzzy
                     goto-last-change
                     markdown-mode
                     flycheck))

(package-initialize)

(unless package-archive-contents
  (package-refresh-contents))

(dolist (package package-list)
  (unless (package-installed-p package)
    (package-install package)))
;; }}}

(byte-recompile-directory "~/.emacs.d")

(add-hook 'after-init-hook (lambda () (load "~/.emacs.d/init")))

;; auto puts
(put 'set-goal-column 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)

(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("melpa" . "http://melpa.milkbox.net/packages/")))

;; from http://stackoverflow.com/questions/10092322/how-to-automatically-install-emacs-packages-by-specifying-a-list-of-package-name (Nicolas Dudebout)
;; {{{
(setq package-list '(ace-jump-mode
                     browse-kill-ring
                     auto-complete
                     lua-mode
                     glsl-mode
                     undo-tree
                     muse
                     htmlize
                     fic-mode
                     web-mode
                     php-mode
                     auto-highlight-symbol
                     org
                     isearch-symbol-at-point
                     ido-ubiquitous
                     ido-vertical-mode
                     smex
                     window-number
                     fuzzy
                     goto-last-change
                     markdown-mode
                     flycheck))

(package-initialize)

(unless package-archive-contents
  (package-refresh-contents))

(dolist (package package-list)
  (unless (package-installed-p package)
    (package-install package)))
;; }}}

(byte-recompile-directory "~/.emacs.d")

(add-hook 'after-init-hook (lambda () (load "~/.emacs.d/init")))

;; auto puts
(put 'set-goal-column 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'downcase-region 'disabled nil)

Add 'muse' and 'htmlize' packages to default install


;;;; Evil mode--Vim-like stuff

(require 'evil)
(require 'key-chord)
(require 'evil-search-highlight-persist)
(require 'evil-surround)

(key-chord-mode t)
(global-evil-leader-mode t)
(global-evil-surround-mode t)
(evil-set-toggle-key "C-M-z") ; because f clobbering my C-z...

(evil-leader/set-leader "<SPC>")
(global-evil-search-highlight-persist t)
(evil-leader/set-key "h" 'evil-search-highlight-persist-remove-all)
(key-chord-define evil-insert-state-map  "jk" 'evil-normal-state) ; inoremap jk <ESC>
(evil-mode t)

(setq evil-shift-width 2)

(provide 'evil-config)

;;;; Evil mode--Vim-like stuff

(require 'evil)
(require 'key-chord)
(require 'evil-search-highlight-persist)
(require 'evil-surround)

(setq evil-shift-width 2)

(key-chord-mode t)
(global-evil-leader-mode t)
(global-evil-surround-mode t)
(evil-set-toggle-key "C-M-z") ; because f clobbering my C-z...

(evil-leader/set-leader "<SPC>")
(global-evil-search-highlight-persist t)
(evil-leader/set-key "h" 'evil-search-highlight-persist-remove-all)
(key-chord-define evil-insert-state-map  "jk" 'evil-normal-state) ; inoremap jk <ESC>
(evil-mode t)

(provide 'evil-config)

Set evil shift width before activating evil-mode, oops


(autoload 'python-mode "python-mode" "Python editing mode." t)
(autoload 'doctest-mode "doctest-mode" "Python doctest editing mode." t)

(setq auto-mode-alist
      (append '(("\\.py$" . python-mode)
		("SConstruct$" . python-mode)
		("SConscript$" . python-mode))
              auto-mode-alist))

(setq interpreter-mode-alist
      (cons '("python" . python-mode) interpreter-mode-alist))

;;----------------------------------------------------------------------------
;; Pymacs and Rope for Python
;;----------------------------------------------------------------------------
;; See http://edward.oconnor.cx/2008/02/ropemacs
(setq pymacs-load-path
      (list (concat el-get-dir "ropemacs")))
(add-hook 'python-mode-hook
          (lambda ()
            (require 'pymacs)
            (pymacs-load "ropemacs" "rope-")))

;;----------------------------------------------------------------------------
;; On-the-fly syntax checking via flymake
;;----------------------------------------------------------------------------
(setq flymake-python-pyflakes-executable "pyflakes-2.6")
(require 'flymake-python)

(add-hook 'python-mode-hook 'flymake-python-load)

(provide 'init-python-mode)

(autoload 'python-mode "python-mode" "Python editing mode." t)
(autoload 'doctest-mode "doctest-mode" "Python doctest editing mode." t)

(setq auto-mode-alist
      (append '(("\\.py$" . python-mode)
		("SConstruct$" . python-mode)
		("SConscript$" . python-mode))
              auto-mode-alist))

(setq interpreter-mode-alist
      (cons '("python" . python-mode) interpreter-mode-alist))

;;----------------------------------------------------------------------------
;; Pymacs and Rope for Python
;;----------------------------------------------------------------------------
;; See http://edward.oconnor.cx/2008/02/ropemacs
(setq pymacs-load-path
      (list (concat el-get-dir "ropemacs")))
(add-hook 'python-mode-hook
          (lambda ()
            (require 'pymacs)
            (pymacs-load "ropemacs" "rope-")))

;;----------------------------------------------------------------------------
;; On-the-fly syntax checking via flymake
;;----------------------------------------------------------------------------
(require 'flymake-python)

(add-hook 'python-mode-hook 'flymake-python-load)

(provide 'init-python-mode)

Remove overridden executable name for pyflakes


(define-package
  "fsharp-mode"
  "0.6"
  "F# mode for Emacs"
  '((pos-tip "0.4.5")))

Fix missing parenthesis in package defn

Fix missing parenthesis in package defn


;; store backups in temp dir
(setq backup-directory-alist
      `((".*" . ,temporary-file-directory)))

;; store auto-saves in temp dir
(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t))
      auto-save-list-file-prefix (concat temporary-file-directory ".auto-saves-"))

;; do not create lockfiles (.#file-name)
(setq create-lockfiles nil)

;; smooth scrolling
(setq scroll-conservatively 10
      scroll-margin 7)

;; show trailing whitespace
(setq show-trailing-whitespace t
      whitespace-style '(face trailing))

;; save cursor position between sessions
(require 'saveplace)
(setq-default save-place t)
(setq save-place-file (expand-file-name ".places" jl/root-dir))

;; set modifier bindings
(setq ns-command-modifier 'meta
      ns-option-modifier 'super
      ns-function-modifier 'hyper)

;; instantly display current keystrokes in mini buffer
(setq echo-keystrokes 0.1)

;; auto-indent on RET
(define-key global-map (kbd "RET") 'newline-and-indent)

(provide 'jl-base)

;; store backups in temp dir
(setq backup-directory-alist
      `((".*" . ,temporary-file-directory)))

;; store auto-saves in temp dir
(setq auto-save-file-name-transforms `((".*" ,temporary-file-directory t))
      auto-save-list-file-prefix (concat temporary-file-directory ".auto-saves-"))

;; do not create lockfiles (.#file-name)
(setq create-lockfiles nil)

;; create new lines on movement at EOF
(setq next-line-add-newlines t)

;; smooth scrolling
(setq scroll-conservatively 10
      scroll-margin 7)

;; show trailing whitespace
(setq show-trailing-whitespace t
      whitespace-style '(face trailing))

;; save cursor position between sessions
(require 'saveplace)
(setq-default save-place t)
(setq save-place-file (expand-file-name ".places" jl/root-dir))

;; set modifier bindings
(setq ns-command-modifier 'meta
      ns-option-modifier 'super
      ns-function-modifier 'hyper)

;; instantly display current keystrokes in mini buffer
(setq echo-keystrokes 0.1)

;; auto-indent on RET
(define-key global-map (kbd "RET") 'newline-and-indent)

(provide 'jl-base)

Create new lines on movement at EOF

emacs: Create new lines on movement at EOF


;; Time-stamp: <2014-07-01 14:16:05 kmodi>

;; Emacs Lisp Mode

(defun my-emacs-lisp-mode-customizations()
  (when (boundp 'setup-linum-loaded)
    (nlinum-mode 1))
  )
(add-hook 'emacs-lisp-mode-hook 'my-emacs-lisp-mode-customizations)

(provide 'setup-elisp)

;; Time-stamp: <2015-01-13 19:55:03 kmodi>

;; Emacs Lisp Mode

(defun my/edebug-defun ()
  (interactive)
  (eval-defun :edebug))

;; edebug
(bind-keys
 :map modi-mode-map
 ("<f7>" . my/edebug-defun) ; add edebug instrumentation
 ("<S-f7>" . eval-defun)) ; remove edebug instrumentation

(provide 'setup-elisp)

Add bindings to quickly add and remove edebug instrumentation


;;; init-github.el --- Github integration -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(require 'init-git)

(maybe-require-package 'yagist)
(require-package 'bug-reference-github)
(add-hook 'prog-mode-hook 'bug-reference-prog-mode)

(maybe-require-package 'github-clone)
(maybe-require-package 'magithub)

(provide 'init-github)
;;; init-github.el ends here

;;; init-github.el --- Github integration -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(require 'init-git)

(maybe-require-package 'yagist)
(require-package 'bug-reference-github)
(add-hook 'prog-mode-hook 'bug-reference-prog-mode)

(maybe-require-package 'github-clone)
(maybe-require-package 'forge)

(provide 'init-github)
;;; init-github.el ends here

Switch from magithub to forge

Switch from magithub to forge


;;; ui/fci/config.el -*- lexical-binding: t; -*-

(defvar +fci-rule-color-function
  (lambda () (face-foreground 'line-number))
  "Color used to draw the fill-column rule.

Accepts a color string or a function that returns a color.

Changes to this variable do not take effect until `fci-mode' is restarted.")

;;
;; Plugins
;;

(def-package! fill-column-indicator
  :hook ((text-mode prog-mode conf-mode) . turn-on-fci-mode)
  :config
  (defun +fci|set-color ()
    "Automatically change `fci-rule-color' based on `+fci-rule-color-function's
return value. To disable this, either set `+fci-rule-color-function' to nil or
remove `+fci|set-color' from `fci-mode-hook'."
    (when (functionp +fci-rule-color-function)
      (setq fci-rule-color (funcall +fci-rule-color-function))))
  (add-hook 'fci-mode-hook #'+fci|set-color)

  (when (featurep! :completion company)
    (add-hook 'company-completion-started-hook #'+fci|disable-when-company-activates)
    (add-hook! '(company-completion-finished-hook company-completion-cancelled-hook)
      #'+fci|enable-when-company-deactivates)))

;;; ui/fci/config.el -*- lexical-binding: t; -*-

(defvar +fci-rule-color-function
  (lambda () (face-foreground 'line-number))
  "Color used to draw the fill-column rule.

Accepts a color string or a function that returns a color.

Changes to this variable do not take effect until `fci-mode' is restarted.")

;;
;; Plugins
;;

(def-package! fill-column-indicator
  :hook ((text-mode prog-mode conf-mode) . turn-on-fci-mode)
  :config
  (add-hook 'org-mode-hook #'turn-off-fci-mode)

  (defun +fci|set-color ()
    "Automatically change `fci-rule-color' based on `+fci-rule-color-function's
return value. To disable this, either set `+fci-rule-color-function' to nil or
remove `+fci|set-color' from `fci-mode-hook'."
    (when (functionp +fci-rule-color-function)
      (setq fci-rule-color (funcall +fci-rule-color-function))))
  (add-hook 'fci-mode-hook #'+fci|set-color)

  (when (featurep! :completion company)
    (add-hook 'company-completion-started-hook #'+fci|disable-when-company-activates)
    (add-hook! '(company-completion-finished-hook company-completion-cancelled-hook)
      #'+fci|enable-when-company-deactivates)))

Disable fci-mode in org-mode by default

Disable fci-mode in org-mode by default

Too many issues caused by variable font and icon sizes in org-mode (see


(add-hook 'clojure-mode-hook (lambda () (enable-paredit clojure-mode-map)))

(setq clojure-src-root (expand-file-name "~/Projects/External"))
(setq swank-clojure-extra-vm-args (list "-server"
                                        "-Xmx1024m"
                                        "-XX:+UseConcMarkSweepGC"
                                        "-XX:+UseCompressedOops"
                                        "-XX:+DoEscapeAnalysis"))

(add-hook 'slime-repl-mode-hook 'slime-redirect-inferior-output)

(eval-after-load "viper"
  '(add-to-list 'viper-vi-state-mode-list 'clojure-mode))

(provide 'init-clojure)

(add-hook 'clojure-mode-hook (lambda () (enable-paredit clojure-mode-map)))

(setq clojure-src-root (expand-file-name "~/Projects/External"))
(setq swank-clojure-extra-vm-args (list "-server"
                                        "-Xmx1024m"
                                        "-XX:+UseConcMarkSweepGC"
                                        "-XX:+UseCompressedOops"
                                        "-XX:+DoEscapeAnalysis"))

(add-hook 'slime-repl-mode-hook 'slime-redirect-inferior-output)

(eval-after-load "viper"
  '(add-to-list 'viper-vi-state-mode-list 'clojure-mode))

(eval-after-load "gist"
  '(add-to-list 'gist-supported-modes-alist '(clojure-mode . ".clj")))

(provide 'init-clojure)

Add clojure to list of supported languages in gist.el


;;; pjs-stardica.el --- Stardica code and config -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(require 'pjs)
(setq pjs-inhibit-clojure-align-on-save 't)
(setq pjs-inhibit-cleanup-on-save 't)
(setq default-directory "~/")

(require 'org)
(require 'projectile)
(setq projectile-project-root-files nil)

(add-to-list 'org-agenda-files "~/clubhouse/clubhouse.org" t)

(remove-hook 'prog-mode-hook 'whitespace-mode)

(use-package clubhouse-backend
  :load-path "~/src/backend/elisp"
  :hook (clojure-mode . clubhouse-backend-font-lock)
  :bind (("C-c C-r" . clubhouse-backend-goto-defresource)))

(provide 'pjs-stardica)
;;; pjs-stardica.el ends here

;;; pjs-stardica.el --- Stardica code and config -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(require 'pjs)
(setq pjs-inhibit-clojure-align-on-save 't)
(setq pjs-inhibit-cleanup-on-save 't)
(setq default-directory "~/")

(require 'org)
(require 'projectile)
(setq projectile-project-root-files nil)

(add-to-list 'org-agenda-files "~/clubhouse/clubhouse.org" t)

(remove-hook 'prog-mode-hook 'whitespace-mode)

(use-package clubhouse-backend
  :load-path "~/src/backend/elisp"
  :if (file-exists-p "~/src/backend/elisp")
  :hook (clojure-mode . clubhouse-backend-font-lock)
  :commands (clubhouse-backend-jack-in-dev-system)
  :bind (("C-c C-r" . clubhouse-backend-goto-defresource)))

(provide 'pjs-stardica)
;;; pjs-stardica.el ends here

Add dev-system jack-in as command

Add dev-system jack-in as command


(require 'init-frame-hooks)

(global-set-key [mouse-4] (lambda () (interactive) (scroll-down 1)))
(global-set-key [mouse-5] (lambda () (interactive) (scroll-up 1)))

(autoload 'mwheel-install "mwheel")

(defun sanityinc/console-frame-setup ()
  (xterm-mouse-mode 1) ; Mouse in a terminal (Use shift to paste with middle button)
  (mwheel-install))

(add-hook 'after-make-console-frame-hooks 'sanityinc/console-frame-setup)

(provide 'init-xterm)

(require 'init-frame-hooks)

(global-set-key [mouse-4] (lambda () (interactive) (scroll-down 1)))
(global-set-key [mouse-5] (lambda () (interactive) (scroll-up 1)))

(defun sanityinc/console-frame-setup ()
  (xterm-mouse-mode 1) ; Mouse in a terminal (Use shift to paste with middle button)
  (mwheel-install))

(add-hook 'after-make-console-frame-hooks 'sanityinc/console-frame-setup)

(provide 'init-xterm)

Remove defunct autoload for mwheel-install


(require 'yasnippet)
(require 'helm-c-yasnippet)
(setq helm-c-yas-space-match-any-greedy t)
(setq yas-snippet-dirs '((concat user-emacs-directory "/snippets")))
(yas-global-mode 1)

(require 'yasnippet)
(require 'helm-c-yasnippet)
(setq helm-c-yas-space-match-any-greedy t)
(setq yas-snippet-dirs '("~/.emacs.d/snippets"))
(yas-global-mode 1)

Fix path to new yas yasnippet

Fix path to new yas yasnippet


;;; init-dired.el --- Dired customisations -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(setq-default dired-dwim-target t)

;; Prefer g-prefixed coreutils version of standard utilities when available
(let ((gls (executable-find "gls")))
  (when gls (setq insert-directory-program gls)))

(when (maybe-require-package 'diredfl)
  (after-load 'dired
    (diredfl-global-mode)))

(after-load 'dired
  (setq dired-recursive-deletes 'top)
  (define-key dired-mode-map [mouse-2] 'dired-find-file)
  (define-key dired-mode-map (kbd "C-c C-q") 'wdired-change-to-wdired-mode))

(when (maybe-require-package 'diff-hl)
  (after-load 'dired
    (add-hook 'dired-mode-hook 'diff-hl-dired-mode)))

(provide 'init-dired)
;;; init-dired.el ends here

;;; init-dired.el --- Dired customisations -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(setq-default dired-dwim-target t)

;; Prefer g-prefixed coreutils version of standard utilities when available
(let ((gls (executable-find "gls")))
  (when gls (setq insert-directory-program gls)))

(when (maybe-require-package 'diredfl)
  (after-load 'dired
    (diredfl-global-mode)
    (require 'dired-x)))

;; Hook up dired-x global bindings without loading it up-front
(define-key ctl-x-map "\C-j" 'dired-jump)
(define-key ctl-x-4-map "\C-j" 'dired-jump-other-window)

(after-load 'dired
  (setq dired-recursive-deletes 'top)
  (define-key dired-mode-map [mouse-2] 'dired-find-file)
  (define-key dired-mode-map (kbd "C-c C-q") 'wdired-change-to-wdired-mode))

(when (maybe-require-package 'diff-hl)
  (after-load 'dired
    (add-hook 'dired-mode-hook 'diff-hl-dired-mode)))

(provide 'init-dired)
;;; init-dired.el ends here

Add dired-jump bindings (C-x C-j, C-x 4 C-j)


(use-package markdown-mode
  :ensure t
  :commands (markdown-mode gfm-mode)
  :mode (("README\\.md\\'" . gfm-mode)
         ("\\.md\\'" . markdown-mode)
         ("\\.markdown\\'" . markdown-mode))
  :init (setq markdown-command "multimarkdown"))
(provide 'markdown-init)

(use-package markdown-mode
  :ensure t
  :commands (markdown-mode gfm-mode)
  :mode (("README\\.md\\'" . gfm-mode)
         ("\\.md\\'" . markdown-mode)
         ("\\.markdown\\'" . markdown-mode))
  :init (setq markdown-command "pandoc"))
(provide 'markdown-init)

Change markdown converter to pandoc

Change markdown converter to pandoc


;; -*- no-byte-compile: t; -*-
;;; core/packages.el

;; core-os.el
(package! exec-path-from-shell :ignore (not IS-MAC))
(package! osx-clipboard        :ignore (not IS-MAC))

;; core-ui.el
(package! all-the-icons)
(package! hide-mode-line)
(package! highlight-indentation)
(package! highlight-numbers)
(unless (boundp 'display-line-numbers)
  (package! nlinum)
  (package! nlinum-hl)
  (package! nlinum-relative))
(package! rainbow-delimiters)
(package! visual-fill-column)
(package! restart-emacs)

;; core-editor.el
(package! ace-link)
(package! ace-window)
(package! avy)
(package! command-log-mode)
(package! dtrt-indent)
(package! expand-region)
(package! helpful)
(package! pcre2el)
(package! smartparens)
(package! undo-tree)

;; core-projects.el
(package! projectile)

;; core-keybinds.el
(package! which-key)
(package! hydra)

;; autoload/debug.el
(package! esup)

Add esup back to core package list

Add esup back to core package list


;; paredit for both clojure and elisp
(defun turn-on-paredit () (paredit-mode 1))
(add-hook 'clojure-mode-hook 'turn-on-paredit)
(add-hook 'emacs-lisp-mode-hook 'turn-on-paredit)

(add-hook 'emacs-lisp-mode-hook
          (lambda ()
            (setq use-hl-line nil)
            (hl-sexp-mode)))
(add-hook 'clojure-mode-hook
          (lambda ()
            (setq use-hl-line nil)
            (hl-sexp-mode)))

;; rather than using TAGS, jump to function definitions that we have
;; loaded
(require 'elisp-slime-nav)
(dolist (hook '(emacs-lisp-mode-hook ielm-mode-hook))
  (add-hook hook 'elisp-slime-nav-mode))

(add-hook 'clojure-mode-hook 'rainbow-delimiters-mode)

(autoload 'clojure-mode "clojure-mode")
(add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode))

(require 'nrepl)

(provide 'lisp-customisations)

;; paredit for both clojure and elisp
(defun turn-on-paredit () (paredit-mode 1))
(add-hook 'clojure-mode-hook 'turn-on-paredit)
(add-hook 'emacs-lisp-mode-hook 'turn-on-paredit)
(add-hook 'scheme-mode-hook 'turn-on-paredit)

(add-hook 'emacs-lisp-mode-hook
          (lambda ()
            (setq use-hl-line nil)
            (hl-sexp-mode)))
(add-hook 'clojure-mode-hook
          (lambda ()
            (setq use-hl-line nil)
            (hl-sexp-mode)))

;; rather than using TAGS, jump to function definitions that we have
;; loaded
(require 'elisp-slime-nav)
(dolist (hook '(emacs-lisp-mode-hook ielm-mode-hook))
  (add-hook hook 'elisp-slime-nav-mode))

(add-hook 'clojure-mode-hook 'rainbow-delimiters-mode)
(add-hook 'scheme-mode-hook 'rainbow-delimiters-mode)

(autoload 'clojure-mode "clojure-mode")
(add-to-list 'auto-mode-alist '("\\.clj$" . clojure-mode))

(require 'nrepl)

(provide 'lisp-customisations)

Use paredit and rainbow-delimiters when coding scheme


(defun set-exec-path-from-shell-PATH ()
  (let ((path-from-shell (shell-command-to-string "$SHELL --login -c 'echo $PATH'")))
    (setenv "PATH" path-from-shell)
    (setq exec-path (split-string path-from-shell path-separator))))

(when *is-a-mac*
  (eval-after-load "woman"
    '(setq woman-manpath (append (list "/opt/local/man") woman-manpath)))

  ;; When started from Emacs.app or similar, ensure $PATH
  ;; is the same the user would see in Terminal.app
  (if window-system (set-exec-path-from-shell-PATH)))

(provide 'init-exec-path)

(defun set-exec-path-from-shell-PATH ()
  (let ((path-from-shell (shell-command-to-string "$SHELL --login -i -c 'echo $PATH'")))
    (setenv "PATH" path-from-shell)
    (setq exec-path (split-string path-from-shell path-separator))))

(when *is-a-mac*
  (eval-after-load "woman"
    '(setq woman-manpath (append (list "/opt/local/man") woman-manpath)))

  ;; When started from Emacs.app or similar, ensure $PATH
  ;; is the same the user would see in Terminal.app
  (if window-system (set-exec-path-from-shell-PATH)))

(provide 'init-exec-path)

Use -i in subshell to ensure default rvm paths get set up


;;; danylo-common-font-lock.el --- Font locking commong code
;;
;; Author: Danylo Malyuta
;;
;; Keywords: font lock
;;
;; This file is not part of GNU Emacs
;;
;;; Commentary:
;;
;;  Font locking common functions.
;;
;;; Code:

(defun danylo/font-lock-extend-region ()
  "Extend the search region to include an entire block of text."
  (let ((changed nil))
    (save-excursion
      (goto-char font-lock-beg)
      (let ((found (or (re-search-backward "\n\n" nil t) (point-min))))
	(unless (eq font-lock-beg found)
	  (goto-char found)
	  (setq font-lock-beg (if (bolp) found (line-beginning-position))
		changed t)))
      (goto-char font-lock-end)
      (let ((found (or (re-search-forward "\n\n" nil t) (point-max))))
	(unless (eq font-lock-end found)
	  (goto-char found)
	  (setq font-lock-end (if (bolp) found (line-beginning-position 2))
		changed t))))
    changed))

(provide 'danylo-common-font-lock)
;;; danylo-common-font-lock.el ends here

;;; danylo-common-font-lock.el --- Font locking commong code
;;
;; Author: Danylo Malyuta
;;
;; Keywords: font lock
;;
;; This file is not part of GNU Emacs
;;
;;; Commentary:
;;
;;  Font locking common functions.
;;
;;; Code:

(defun danylo/font-lock-extend-region ()
  "Extend the search region to include an entire block of text."
  (let ((changed nil))
    (save-excursion
      (goto-char font-lock-beg)
      (let ((found (or (re-search-backward "^\n$" nil t) (point-min))))
	(unless (eq font-lock-beg found)
	  (goto-char found)
	  (setq font-lock-beg (if (bolp) found (line-beginning-position))
		changed t)))
      (goto-char font-lock-end)
      (let ((found (or (re-search-forward "^\n$" nil t) (point-max))))
	(unless (eq font-lock-end found)
	  (goto-char found)
	  (setq font-lock-end (if (bolp) found (line-beginning-position 2))
		changed t))))
    changed))

(provide 'danylo-common-font-lock)
;;; danylo-common-font-lock.el ends here

Update font lock region extend to better version that fixes some bugs in Org


(server-start)

;; make C-x k work for emacsclient sessions too.
(add-hook 'server-switch-hook
  (lambda ()
    (when server-buffer-clients
      (local-set-key (kbd "C-x k") 'server-edit)
     )
   )
 )

(server-start)

(defun my/kill-buffer-or-server-edit ()
  (interactive)
  (if server-buffer-clients
      (server-edit)
    (kill-buffer)
   )
 )

;; make C-x k work for emacsclient sessions too.
(add-hook 'server-switch-hook
  (lambda ()
    (local-set-key (kbd "C-x k") 'my/kill-buffer-or-server-edit)
   )
 )

Fix handling of C-x k.

Fix handling of C-x k.


;; Configuration for Scala

;; ENSIME
(use-package ensime
  :ensure t
  :defer t
  :config (progn (add-hook 'scala-mode-hook 'ensime-scala-mode-hook)))

;; Configuration for Scala

(defun scala/enable-eldoc ()
  "Show the type of the symbol under the cursor"
  (setq-local eldoc-documentation-function
              (lambda ()
                (when (ensime-connected-p)
                  (ensime-print-type-at-point))))
  (eldoc-mode +1))

;; ENSIME
(use-package ensime
  :ensure t
  :defer t
  :config (progn (add-hook 'scala-mode-hook 'ensime-scala-mode-hook)
                 (add-hook 'ensime-mode-hook #'scala/enable-eldoc)))

Add function in Scala IDE configuration

[EMACS] Add function in Scala IDE configuration

The function 'scala/enable-eldoc' show the type of the symbol under the
cursor using ENSIME and ElDoc.


;; -*- lexical-binding: t -*-

(defconst my-lisp-packages '((emacs-lisp :location built-in)
                             evil-lisp-state
                             expand-region))

(defun my-lisp/post-init-emacs-lisp ()
  (when (configuration-layer/package-used-p 'aggressive-indent)
    (add-hook 'emacs-lisp-mode-hook #'aggressive-indent-mode)))

(defun my-lisp/post-init-evil-lisp-state ()
  (with-eval-after-load 'evil-lisp-state
    (define-key evil-lisp-state-map "A" #'my-lisp/insert-at-end-of-sexp)
    (define-key evil-lisp-state-map "I" #'my-lisp/insert-at-beginning-of-sexp)
    (define-key evil-lisp-state-map "C" #'sp-clone-sexp)))

(defun my-lisp/post-init-expand-region ()
  (with-eval-after-load 'expand-region
    (er/enable-mode-expansions 'emacs-lisp-mode
                               #'my-lisp//add-emacs-lisp-mode-expansions)))

;; -*- lexical-binding: t -*-

(defconst my-lisp-packages '((emacs-lisp :location built-in)
                             evil-lisp-state
                             expand-region
                             faceup
                             font-lock-studio))

(defun my-lisp/post-init-emacs-lisp ()
  (when (configuration-layer/package-used-p 'aggressive-indent)
    (add-hook 'emacs-lisp-mode-hook #'aggressive-indent-mode)))

(defun my-lisp/post-init-evil-lisp-state ()
  (with-eval-after-load 'evil-lisp-state
    (define-key evil-lisp-state-map "A" #'my-lisp/insert-at-end-of-sexp)
    (define-key evil-lisp-state-map "I" #'my-lisp/insert-at-beginning-of-sexp)
    (define-key evil-lisp-state-map "C" #'sp-clone-sexp)))

(defun my-lisp/post-init-expand-region ()
  (with-eval-after-load 'expand-region
    (er/enable-mode-expansions 'emacs-lisp-mode
                               #'my-lisp//add-emacs-lisp-mode-expansions)))

(defun my-lisp/init-faceup ()
  (use-package faceup
    :defer t))

(defun my-lisp/init-font-lock-studio ()
  (use-package font-lock-studio
    :defer t))

Install tools to debug syntax highlighting


(require-package 'color-theme-sanityinc-solarized)
(require-package 'color-theme-sanityinc-tomorrow)

;; If you don't customize it, this is the theme you get.
(setq-default custom-enabled-themes '(sanityinc-tomorrow-bright))

;; Ensure that themes will be applied even if they have not been customized
(defun reapply-themes ()
  "Forcibly load the themes listed in `custom-enabled-themes'."
  (dolist (theme custom-enabled-themes)
    (unless (custom-theme-p theme)
      (load-theme theme)))
  (custom-set-variables `(custom-enabled-themes (quote ,custom-enabled-themes))))

(add-hook 'after-init-hook 'reapply-themes)

;;------------------------------------------------------------------------------
;; Toggle between light and dark
;;------------------------------------------------------------------------------
(defun light ()
  "Activate a light color theme."
  (interactive)
  (setq custom-enabled-themes '(sanityinc-tomorrow-day))
  (reapply-themes))

(defun dark ()
  "Activate a dark color theme."
  (interactive)
  (setq custom-enabled-themes '(sanityinc-tomorrow-bright))
  (reapply-themes))

(when (maybe-require-package 'dimmer)
  (setq-default dimmer-fraction 0.15)
  (add-hook 'after-init-hook 'dimmer-mode))

(provide 'init-themes)

(require-package 'color-theme-sanityinc-solarized)
(require-package 'color-theme-sanityinc-tomorrow)

;; If you don't customize it, this is the theme you get.
(setq-default custom-enabled-themes '(sanityinc-tomorrow-bright))

;; Ensure that themes will be applied even if they have not been customized
(defun reapply-themes ()
  "Forcibly load the themes listed in `custom-enabled-themes'."
  (dolist (theme custom-enabled-themes)
    (unless (custom-theme-p theme)
      (load-theme theme)))
  (custom-set-variables `(custom-enabled-themes (quote ,custom-enabled-themes))))

(add-hook 'after-init-hook 'reapply-themes)

;;------------------------------------------------------------------------------
;; Toggle between light and dark
;;------------------------------------------------------------------------------
(defun light ()
  "Activate a light color theme."
  (interactive)
  (setq custom-enabled-themes '(sanityinc-tomorrow-day))
  (reapply-themes))

(defun dark ()
  "Activate a dark color theme."
  (interactive)
  (setq custom-enabled-themes '(sanityinc-tomorrow-bright))
  (reapply-themes))

(when (maybe-require-package 'dimmer)
  (setq-default dimmer-fraction 0.15)
  (add-hook 'after-init-hook 'dimmer-mode)
  ;; TODO: file upstream as a PR
  (advice-add 'frame-set-background-mode :after (lambda (&rest args) (dimmer-process-all))))

(provide 'init-themes)

Refresh "dimmer" state when the frame background mode changes


(eval-after-load "package"
  '(when (> emacs-major-version 23)
     (setq package-archives (cons '("tromey" . "http://tromey.com/elpa/") package-archives))))

(provide 'init-elpa)

(eval-after-load "package"
  '(progn
     (when (> emacs-major-version 23)
       (add-to-list 'package-archives '("tromey" . "http://tromey.com/elpa/")))

     (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/"))
     (add-to-list 'package-archives '("technomancy" . "http://repo.technomancy.us/emacs"))
))

(provide 'init-elpa)

Add marmalade to package archives list

Add marmalade to package archives list


;; -*- no-byte-compile: t; -*-
;;; core/packages.el

;; core.el
(package! dotenv-mode)
(package! auto-minor-mode)

;; core-ui.el
(package! all-the-icons)
(package! hide-mode-line)
(package! highlight-numbers)
(unless (locate-library "display-line-numbers")
  (package! nlinum)
  (package! nlinum-hl)
  (package! nlinum-relative))
(package! rainbow-delimiters)
(package! restart-emacs)

;; core-editor.el
(package! better-jumper)
(package! dtrt-indent)
(package! helpful)
(package! ns-auto-titlebar :ignore (not IS-MAC))
(package! pcre2el)
(package! smartparens)
(package! so-long
  :built-in 'prefer
  :recipe (:repo "https://git.savannah.gnu.org/git/so-long.git"))
(package! osx-clipboard :ignore (not IS-MAC))
(package! undo-tree)
(package! ws-butler)
(package! xclip :ignore IS-LINUX)

;; core-projects.el
(package! projectile)

;; core-keybinds.el
(package! general)
(package! which-key)

;; -*- no-byte-compile: t; -*-
;;; core/packages.el

;; core.el
(package! dotenv-mode)
(package! auto-minor-mode)

;; core-ui.el
(package! all-the-icons)
(package! hide-mode-line)
(package! highlight-numbers)
(unless (locate-library "display-line-numbers")
  (package! nlinum)
  (package! nlinum-hl)
  (package! nlinum-relative))
(package! rainbow-delimiters)
(package! restart-emacs)

;; core-editor.el
(package! better-jumper)
(package! dtrt-indent)
(package! helpful)
(package! ns-auto-titlebar :ignore (not IS-MAC))
(package! pcre2el)
(package! smartparens)
(package! so-long
  :built-in 'prefer
  :recipe (:repo "https://git.savannah.gnu.org/git/so-long.git"))
(package! osx-clipboard :ignore (not IS-MAC))
(package! undo-tree)
(package! ws-butler)
(package! xclip :ignore (not IS-LINUX))

;; core-projects.el
(package! projectile)

;; core-keybinds.el
(package! general)
(package! which-key)

Fix xclip exclusion on linux

Fix xclip exclusion on linux

Due to unintentionally inverted condition


;; Time-stamp: <2015-07-15 12:09:48 kmodi>

;; Which Key
;; https://github.com/justbur/emacs-which-key

(use-package which-key
  :defer 15
  :config
  (progn
    (setq which-key-popup-type 'minibuffer) ; default
    ;; (setq which-key-popup-type 'side-window)

    (setq which-key-key-replacement-alist
          '(("<\\(\\(C-\\|M-\\)*.+\\)>" . "\\1")
            ("left"  . "◀")
            ("right" . "▶")
            ("up"    . "▲")
            ("down"  . "▼")))
    (setq which-key-special-keys '("SPC" "TAB" "RET" "ESC" "DEL"))

    (which-key-mode 1)))

(provide 'setup-which-key)

;; Time-stamp: <2015-07-15 14:30:33 kmodi>

;; Which Key
;; https://github.com/justbur/emacs-which-key

(use-package which-key
  :defer 15
  :config
  (progn
    (setq which-key-popup-type 'minibuffer) ; default
    ;; (setq which-key-popup-type 'side-window)

    (setq which-key-key-replacement-alist
          '(("<\\(\\(C-\\|M-\\)*.+\\)>" . "\\1")
            ("left"  . "◀")
            ("right" . "▶")
            ("up"    . "▲")
            ("down"  . "▼")))

    (setq which-key-special-keys '("SPC" "TAB" "RET" "ESC" "DEL"))

    (setq which-key-key-based-description-replacement-alist
          '(("C-x 8" . "unicode")
            ("C-x a" . "abbrev/expand")
            ("C-x r" . "rect/reg")
            ("C-x w" . "hi-lock-map")
            ("C-c /" . "engine-mode-map")))

    (which-key-mode 1)))

(provide 'setup-which-key)

Customize prefix map strings in which-key popups


;;; init-lisp.el -- Lisp and like setup

;;; Commentary:
;;; Lisp editing setup for Emacs
;;; Code:
(defvar my-lisp-modes
  '(cider-repl-mode clojure-mode emacs-lisp-mode lisp-mode))
(use-package aggressive-indent
  :commands (aggressive-indent-mode)
  :init
  (dolist (lisp my-lisp-modes)
    (add-hook (make-symbol (concat (symbol-name lisp) "-hook")) 'aggressive-indent-mode))
  (add-hook 'emacs-lisp-mode-hook 'aggressive-indent-mode))

(use-package paredit
  :commands (paredit-mode)
  :init
  (dolist (lisp my-lisp-modes)
    (add-hook (make-symbol (concat (symbol-name lisp) "-hook")) 'paredit-mode))
  :diminish paredit-mode)

(add-hook 'emacs-lisp-mode-hook (lambda() (setq mode-name "Elisp")))

(provide 'init-lisp)
;;; init-lisp.el ends here

;;; init-lisp.el -- Lisp and like setup

;;; Commentary:
;;; Lisp editing setup for Emacs
;;; Code:
(use-package aggressive-indent
  :commands (aggressive-indent-mode)
  :init
  (add-hook 'cider-repl-mode-hook 'aggressive-indent-mode)
  (add-hook 'clojure-mode-hook 'aggressive-indent-mode)
  (add-hook 'emacs-lisp-mode-hook 'aggressive-indent-mode)
  (add-hook 'lisp-mode-hook 'aggressive-indent-mode))

(use-package paredit
  :commands (paredit-mode)
  :init
  (add-hook 'cider-repl-mode-hook 'paredit-mode)
  (add-hook 'clojure-mode-hook 'paredit-mode)
  (add-hook 'emacs-lisp-mode-hook 'paredit-mode)
  (add-hook 'lisp-mode-hook 'paredit-mode)
  :diminish paredit-mode)

(add-hook 'emacs-lisp-mode-hook (lambda() (setq mode-name "Elisp")))

(provide 'init-lisp)
;;; init-lisp.el ends here
;; fuzzy find in current project with ,t

Fix paredit and aggressive-indent hooks in Lisps


;;; init-python.el --- Python editing -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

(setq auto-mode-alist
      (append '(("SConstruct\\'" . python-mode)
                ("SConscript\\'" . python-mode))
              auto-mode-alist))

(require-package 'pip-requirements)

(when (maybe-require-package 'anaconda-mode)
  (after-load 'python
    (add-hook 'python-mode-hook 'anaconda-mode)
    (add-hook 'python-mode-hook 'anaconda-eldoc-mode))
  (after-load 'anaconda-mode
    (define-key anaconda-mode-map (kbd "M-?") nil))
  (when (maybe-require-package 'company-anaconda)
    (after-load 'company
      (after-load 'python
        (push 'company-anaconda company-backends)))))

(provide 'init-python)
;;; init-python.el ends here

;;; init-python.el --- Python editing -*- lexical-binding: t -*-
;;; Commentary:
;;; Code:

;; See the following note about how I set up python + virtualenv to
;; work seamlessly with Emacs:
;; https://gist.github.com/purcell/81f76c50a42eee710dcfc9a14bfc7240

(setq auto-mode-alist
      (append '(("SConstruct\\'" . python-mode)
                ("SConscript\\'" . python-mode))
              auto-mode-alist))

(require-package 'pip-requirements)

(when (maybe-require-package 'anaconda-mode)
  (after-load 'python
    (add-hook 'python-mode-hook 'anaconda-mode)
    (add-hook 'python-mode-hook 'anaconda-eldoc-mode))
  (after-load 'anaconda-mode
    (define-key anaconda-mode-map (kbd "M-?") nil))
  (when (maybe-require-package 'company-anaconda)
    (after-load 'company
      (after-load 'python
        (push 'company-anaconda company-backends)))))

(provide 'init-python)
;;; init-python.el ends here

Add note about python and virtualenvs

Add note about python and virtualenvs


;; On OS X Emacs doesn't use the shell PATH if it's not started from
;; the shell. If you're using homebrew modifying the PATH is essential.
(push "/usr/local/bin" exec-path)
(setenv "PATH" (concat "/usr/local/bin:" (getenv "PATH")))

;; Emacs users obviously have little need for Command and Option keys,
;; but they do need Meta and Super
(setq mac-command-modifier 'super)
(setq mac-option-modifier 'meta)
(provide 'prelude-osx)

;; On OS X Emacs doesn't use the shell PATH if it's not started from
;; the shell.
;; If you're using homebrew or port, modifying the PATH is essential.
(let (osx-paths)
  (dolist (path '("/usr/local/bin" "/opt/local/bin" "/opt/local/sbin") (setenv "PATH" (concat osx-paths (getenv "PATH"))))
    (push path exec-path)
    (setq osx-paths (concat (concat path ":") osx-paths))))

;; Emacs users obviously have little need for Command and Option keys,
;; but they do need Meta and Super
(setq mac-command-modifier 'super)
(setq mac-option-modifier 'meta)
(provide 'prelude-osx)

Add path support for macports binaries

OSX: Add path support for macports binaries

macports binaries are located at /opt/local/bin and sbin


;; -*- Mode: Emacs-Lisp -*-
;; -*- lisp -*-
;; ~/.emacs.d/after-init.el
;; Load extra packages installed with elpa
;; Jaseem Abid <jaseemabid@gmail.com>

;; centered cursor mode
(require 'centered-cursor-mode)
(global-centered-cursor-mode t)
;; Snippets
(require 'yasnippet)
(yas-global-mode 1)
;; Explain an HTTP status code.
;; Run it with M-x hc
(require 'httpcode)
;; Hackernews :)
(require 'hackernews)
;; Multiple cursors
;; Tutorial : http://emacsrocks.com/e13.html
(require 'multiple-cursors)
;; Expand region
(require 'expand-region)
(global-set-key (kbd "C-M-e") 'er/expand-region)
(global-set-key (kbd "C-M-i") 'er/mark-inner-tag)
(global-set-key (kbd "C-M-o") 'er/mark-outer-tag)
;; git-commit-mode
(require 'magit)
(add-hook 'magit-log-edit-mode-hook 'git-commit-mode-magit-setup)
;; Remember mode
(require 'remember)
;; Coffee-mode
(require 'coffee-mode)
;; Rainbow-mode
(require 'rainbow-mode)
;; rinari
(require 'rinari)
(global-rinari-mode)

Enable rinari global mode, not minor mode


(setf inhibit-startup-screen t) ; disable welcome screen

(setf ring-bell-function 'ignore) ; disable alarm bell

(when (not (display-graphic-p))
  (menu-bar-mode -1)) ; disable menu bar in CLI

;; improve scrolling
(setf scroll-margin 5
      scroll-step 1
      scroll-conservatively 10000
      scroll-up-aggressively 0.01
      scroll-down-aggressively 0.01)

(show-paren-mode 1) ; highlight matching parens

(global-hl-line-mode 1) ; highlight current line

(setq-default indent-tabs-mode nil) ; use spaces instead of tabs

(xterm-mouse-mode 1) ; enable mouse support in terminal

Enable mouse support for terminal Emacs

Enable mouse support for terminal Emacs


;; config-org.el ---

(require 'org-exp)
(require 'org-install)
(org-remember-insinuate)

(set-face-foreground 'org-hide (face-background 'default))
(setq org-directory (concat emacs-config-dir "/jerry/org")
      org-agenda-files (list (concat org-directory "/gtd.org")
			     (concat org-directory "/notes.org"))
      org-completion-use-ido t
      org-default-notes-file (concat org-directory "/notes.org")
      org-hide-leading-stars t ;ֻʾһ㼶 *
      org-id-locations-file "~/.emacs.d/auto-save-list/.org-id-locations"
      org-log-done 'note
      org-startup-truncated nil
      org-export-html-style-include-default nil
      org-export-html-toplevel-hlevel 1
      org-export-html-postamble nil
      )
(add-to-list 'org-export-language-setup (list "zh" "" "" "Ŀ¼" ""))
(define-key global-map (kbd "C-c a") 'org-agenda)
(define-key global-map (kbd "C-c l") 'org-store-link)
(define-key global-map (kbd "C-c c") 'org-capture)

(provide 'config-org)
;;; config-org.el ends here ---

;; config-org.el ---

(require 'org-exp)
(require 'org-install)
(org-remember-insinuate)

(set-face-foreground 'org-hide (face-background 'default))
(setq org-directory "~/Ubuntu One/org"
      org-agenda-files (list (concat org-directory "/gtd.org")
			     (concat org-directory "/notes.org"))
      org-completion-use-ido t
      org-default-notes-file (concat org-directory "/notes.org")
      org-hide-leading-stars t ;ֻʾһ㼶 *
      org-id-locations-file "~/.emacs.d/auto-save-list/.org-id-locations"
      org-log-done 'note
      org-startup-truncated nil
      org-export-html-style-include-default nil
      org-export-html-toplevel-hlevel 1
      org-export-html-postamble nil
      )
(add-to-list 'org-export-language-setup (list "zh" "" "" "Ŀ¼" ""))
(define-key global-map (kbd "C-c a") 'org-agenda)
(define-key global-map (kbd "C-c l") 'org-store-link)
(define-key global-map (kbd "C-c c") 'org-capture)

(provide 'config-org)
;;; config-org.el ends here ---

Change org directory to correct one.

Change org directory to correct one.


(defconst mfa-iimage-packages '(iimage))

(defun mfa-iimage/init-iimage ()
  (use-package iimage
    :defer t
    :init
    (progn
      (spacemacs/declare-prefix "ot" "toggles")
      (spacemacs/set-leader-keys "oti" #'iimage-mode))))

(defconst mfa-iimage-packages '(iimage))

(defun mfa-iimage/init-iimage ()
  (use-package iimage
    :defer t))

Remove image-mode key bindings because they shadow terminal bindings


;; Apple specific stuff

;; On OS X GUI applications do not inherit variables from the shell
;; configuration and thus have a different $PATH
;; test by doing "M-: (executable-find "flake8")"
;; C-h v exec-path
(exec-path-from-shell-initialize)

;; This is for mu4e to be able to get gpg going (sig verifying etc)
;; I was unable to M-x getenv RET GPG_AGENT_INFO (even if I manually set it,
;; as gpg-agent form gpgtools.org does not export this)
;; M-x shell-copy-environment-variable was no help either
;; This should be no problem in *nix's
(setenv "GPG_AGENT_INFO" "~/.gnupg/S.gpg-agent")

(setq mac-option-modifier 'super)
(setq mac-command-modifier 'meta)
(setq ns-function-modifier 'hyper)

;; Ignore .DS_Store files with ido mode
(add-to-list 'ido-ignore-files "\\.DS_Store")

(provide '_mac)

;; Apple specific stuff

;; On OS X GUI applications do not inherit variables from the shell
;; configuration and thus have a different $PATH
;; test by doing "M-: (executable-find "flake8")"
;; C-h v exec-path
(exec-path-from-shell-initialize)

;; This is for mu4e to be able to get gpg going (sig verifying etc)
;; I was unable to M-x getenv RET GPG_AGENT_INFO (even if I manually set it,
;; as gpg-agent form gpgtools.org does not export this)
;; M-x shell-copy-environment-variable was no help either
;; This should be no problem in *nix's
(setenv "GPG_AGENT_INFO" "~/.gnupg/S.gpg-agent")

;; switch modifiers in system prefs
;; (setq mac-option-modifier 'super)
;; (setq mac-command-modifier 'meta)
(setq ns-function-modifier 'hyper)

;; Ignore .DS_Store files with ido mode
(add-to-list 'ido-ignore-files "\\.DS_Store")

(provide '_mac)

Switch alt-cmd keys in OS prefs

[OSX] Switch alt-cmd keys in OS prefs


;; IRC reconnect
(eval-after-load 'rcirc
  '(defun-rcirc-command reconnect (arg)
	 "Reconnect the server process."
	 (interactive "i")
	 (unless process
	   (error "There's no process for this target"))
	 (let* ((server (car (process-contact process)))
		(port (process-contact process :service))
		(nick (rcirc-nick process))
		channels query-buffers)
	   (dolist (buf (buffer-list))
	 (with-current-buffer buf
	   (when (eq process (rcirc-buffer-process))
		 (remove-hook 'change-major-mode-hook
			  'rcirc-change-major-mode-hook)
		 (if (rcirc-channel-p rcirc-target)
		 (setq channels (cons rcirc-target channels))
		   (setq query-buffers (cons buf query-buffers))))))
	   (delete-process process)
	   (rcirc-connect server port nick
			  rcirc-default-user-name
			  rcirc-default-full-name
			  channels))))

;; Shortcut to connect to IRC
(defun irc ()
  "Connect to IRC"
  (interactive)
  (circe "Freenode"))

;; Enable chanop commands
(eval-after-load 'circe '(require 'circe-chanop))

;; Circe (IRC) configuration
;; Put your configuration in a ~/.private.el file with permissions 0600
(load-file "~/.private.el")
(setq circe-network-options
	  `(("Freenode"
		 :nick ,freenode-user
		 :channels ("#mlug-au")
		 :nickserv-password ,freenode-password
		 )))

Add more to irc config

Add more to irc config


(defun sanityinc/utf8-locale-p (v)
  "Return whether locale string V relates to a UTF-8 locale."
  (and v (string-match "UTF-8" v)))

(defun locale-is-utf8-p ()
  "Return t iff the \"locale\" command or environment variables prefer UTF-8."
  (or (sanityinc/utf8-locale-p (and (executable-find "locale") (shell-command-to-string "locale")))
      (sanityinc/utf8-locale-p (getenv "LC_ALL"))
      (sanityinc/utf8-locale-p (getenv "LC_CTYPE"))
      (sanityinc/utf8-locale-p (getenv "LANG"))))

(when (or window-system (locale-is-utf8-p))
  (setq utf-translate-cjk-mode nil) ; disable CJK coding/encoding (Chinese/Japanese/Korean characters)
  (set-language-environment 'utf-8)
  (setq locale-coding-system 'utf-8)
  (set-default-coding-systems 'utf-8)
  (set-terminal-coding-system 'utf-8)
  (unless (eq system-type 'windows-nt)
   (set-selection-coding-system 'utf-8))
  (prefer-coding-system 'utf-8))

(provide 'init-locales)

(defun sanityinc/utf8-locale-p (v)
  "Return whether locale string V relates to a UTF-8 locale."
  (and v (string-match "UTF-8" v)))

(defun locale-is-utf8-p ()
  "Return t iff the \"locale\" command or environment variables prefer UTF-8."
  (or (sanityinc/utf8-locale-p (and (executable-find "locale") (shell-command-to-string "locale")))
      (sanityinc/utf8-locale-p (getenv "LC_ALL"))
      (sanityinc/utf8-locale-p (getenv "LC_CTYPE"))
      (sanityinc/utf8-locale-p (getenv "LANG"))))

(when (or window-system (locale-is-utf8-p))
  (setq utf-translate-cjk-mode nil) ; disable CJK coding/encoding (Chinese/Japanese/Korean characters)
  (set-language-environment 'utf-8)
  (setq locale-coding-system 'utf-8)
  (set-default-coding-systems 'utf-8)
  (set-terminal-coding-system 'utf-8)
  (set-selection-coding-system (if (eq system-type 'windows-nt) 'utf-16-le 'utf-8))
  (prefer-coding-system 'utf-8))

(provide 'init-locales)

Use utf-16-le for selection-coding-system on windows

See https://stackoverflow.com/questions/2901541/which-coding-system-should-i-use-in-emacs/2903256#comment20730840_2903256


(defconst mfa-editorconfig-packages '(editorconfig))

(defun mfa-editorconfig/init-editorconfig ()
  (use-package editorconfig
    :config
    (add-to-list 'edconf-custom-hooks
                 '(lambda (props)
                    (maphash (lambda (key value)
                               (progn
                                 ;; undo require-final-newline to get compatible with ethan-wspace
                                 ;; should probably be moved to ethan-wspace layer
                                 (when (eq 'insert_final_newline key)
                                   (setq require-final-newline nil
                                         mode-require-final-newline nil))
                                 (message "editorconfig set %s to %s" key value)))
                             props)))))

(defconst mfa-editorconfig-packages '(editorconfig))

(defun mfa-editorconfig/init-editorconfig ()
  (use-package editorconfig
    :diminish
    :init
    (editorconfig-mode)
    :config
    (progn
      (spacemacs|hide-lighter editorconfig-mode)
      (defvar mfa/edconf-verbose nil)
      (add-to-list 'edconf-custom-hooks
                   '(lambda (props)
                      (maphash (lambda (key value)
                                 (when mfa/edconf-verbose
                                   (message "editorconfig set %s to %s" key value)))
                               props))))))

Remove references to ethan-wspace in editorconfig-mode config


;; Font
(set-face-attribute 'default nil
                    :family "Menlo"
                    :height 120)
(set-face-attribute 'fixed-pitch nil
                    :family 'unspecified
                    :inherit 'default)

;; Turn off mouse interface early in startup to avoid momentary display
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'tabbar-mode) (tabbar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))

;; vertical window split
(setq split-width-threshold 190)
(setq split-height-threshold nil)

;; Line wrap indicator
(setq-default visual-line-fringe-indicators '(left-curly-arrow nil))

(show-paren-mode 1)

(provide 'setup-interface)

;; Font
(set-face-attribute 'default nil
                    :family "Menlo"
                    :height 160)
(set-face-attribute 'fixed-pitch nil
                    :family 'unspecified
                    :inherit 'default)

;; Turn off mouse interface early in startup to avoid momentary display
(if (fboundp 'menu-bar-mode) (menu-bar-mode -1))
(if (fboundp 'tabbar-mode) (tabbar-mode -1))
(if (fboundp 'tool-bar-mode) (tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode) (scroll-bar-mode -1))

;; vertical window split
(setq split-width-threshold 190)
(setq split-height-threshold nil)

;; Line wrap indicator
(setq-default visual-line-fringe-indicators '(left-curly-arrow nil))

;; Fill column
(setq fill-column 80)

(show-paren-mode 1)

(provide 'setup-interface)

Increase font height and set fill-column to 80


(load-theme 'heroku t)

;; don't beep but flash the screen
;; font-lock-mode provides the colors for spec languages, set max fontification (1-3)
;; force color theme (no increments)
;; don't truncate on partial width
(setq visible-bell t
      font-lock-maximum-decoration t
      color-theme-is-global t
      truncate-partial-width-windows nil)

;; Enable syntax highlighting for older Emacsen that have it off
(global-font-lock-mode t)

;; Highlight current line
(global-hl-line-mode 1)

;; Don't defer screen updates when performing operations
(setq redisplay-dont-pause t)

;; Highlight matching parentheses when the point is on them.
(show-paren-mode 1)

(when window-system
  (setq frame-title-format '(buffer-file-name "%f" ("%b")))
;;  (tooltip-mode -1)
  (blink-cursor-mode -1))

;; Show active region
(transient-mark-mode 1)
(make-variable-buffer-local 'transient-mark-mode)
(put 'transient-mark-mode 'permanent-local t)
(setq-default transient-mark-mode t)

;; Don't highlight matches with jump-char - it's distracting
(setq jump-char-lazy-highlight-face nil)

;; Fontify org-mode code blocks
(setq org-src-fontify-natively t)

(provide '_appearance)

(load-theme 'solarized-dark t)

;; don't beep but flash the screen
;; font-lock-mode provides the colors for spec languages, set max fontification (1-3)
;; force color theme (no increments)
;; don't truncate on partial width
(setq visible-bell t
      font-lock-maximum-decoration t
      color-theme-is-global t
      truncate-partial-width-windows nil)

;; Enable syntax highlighting for older Emacsen that have it off
(global-font-lock-mode t)

;; Highlight current line
(global-hl-line-mode 1)

;; Don't defer screen updates when performing operations
(setq redisplay-dont-pause t)

;; Highlight matching parentheses when the point is on them.
(show-paren-mode 1)

(when window-system
  (setq frame-title-format '(buffer-file-name "%f" ("%b")))
;;  (tooltip-mode -1)
  (blink-cursor-mode -1))

;; Show active region
(transient-mark-mode 1)
(make-variable-buffer-local 'transient-mark-mode)
(put 'transient-mark-mode 'permanent-local t)
(setq-default transient-mark-mode t)

;; Don't highlight matches with jump-char - it's distracting
(setq jump-char-lazy-highlight-face nil)

;; Fontify org-mode code blocks
(setq org-src-fontify-natively t)

(provide '_appearance)

Change default theme -> solarized-dark

Change default theme -> solarized-dark


(setq lua-packages
  '(
    flycheck
    lua-mode
    ))

(defun lua/post-init-flycheck ()
  (add-hook 'lua-mode-hook 'flycheck-mode))

(defun lua/init-lua-mode ()
  (use-package lua-mode
    :defer t
    :mode ("\\.lua\\'" . lua-mode)
    :interpreter ("lua" . lua-mode)
    :config
    (progn
      (setq lua-indent-level 2
            lua-indent-string-contents t)
      (evil-leader/set-key-for-mode 'lua-mode "md" 'lua-search-documentation)
      (evil-leader/set-key-for-mode 'lua-mode "msb" 'lua-send-buffer)
      (evil-leader/set-key-for-mode 'lua-mode "msf" 'lua-send-defun)
      (evil-leader/set-key-for-mode 'lua-mode "msl" 'lua-send-current-line)
      (evil-leader/set-key-for-mode 'lua-mode "msr" 'lua-send-region))))

(setq lua-packages
  '(
    company
    flycheck
    lua-mode
    ))

(defun lua/post-init-flycheck ()
  (add-hook 'lua-mode-hook 'flycheck-mode))

(defun lua/init-lua-mode ()
  (use-package lua-mode
    :defer t
    :mode ("\\.lua\\'" . lua-mode)
    :interpreter ("lua" . lua-mode)
    :config
    (progn
      (setq lua-indent-level 2
            lua-indent-string-contents t)
      (evil-leader/set-key-for-mode 'lua-mode "md" 'lua-search-documentation)
      (evil-leader/set-key-for-mode 'lua-mode "msb" 'lua-send-buffer)
      (evil-leader/set-key-for-mode 'lua-mode "msf" 'lua-send-defun)
      (evil-leader/set-key-for-mode 'lua-mode "msl" 'lua-send-current-line)
      (evil-leader/set-key-for-mode 'lua-mode "msr" 'lua-send-region))))

(defun lua/post-init-company ()
  (add-hook 'lua-mode-hook 'company-mode))

Add company-mode hook for lua

Add company-mode hook for lua


; .emacs specific for Ubuntu Trusty

; 3/5/2015 for ibus
(require 'ibus)
(add-hook 'after-init-hook 'ibus-mode-on)
(add-hook 'after-init-hook 'ibus-mode)

;; Custom ROS location
(set-register ?r '(file . "~/link/ROS/indigo_trusty/"))

;;20160429 Moved from downstream (kudu1, Trusty 14.04), hoping this is valid for all Ubuntu machines.
;;ɥ뵭ϤȤľϤڤؤ롣
;;;(define-key mozc-mode-map "$" 'YaTeX-insert-dollar-or-mozc-insert)
(define-key mozc-mode-map "\C-\o" 'YaTeX-insert-dollar-or-mozc-insert)
(defun YaTeX-insert-dollar-or-mozc-insert ()
  (interactive)
  (if (eq major-mode 'yatex-mode)
      (YaTeX-insert-dollar)
    (mozc-insert)))

; .emacs specific for Ubuntu Trusty

; 3/5/2015 for ibus
(require 'ibus)
(add-hook 'after-init-hook 'ibus-mode-on)
(add-hook 'after-init-hook 'ibus-mode)

;; Custom ROS location
(set-register ?r '(file . "~/link/ROS/indigo_trusty/"))

;;20160429 Moved from downstream (kudu1, Trusty 14.04), hoping this is valid for all Ubuntu machines.
;; mozc
(require 'mozc)
(setq default-input-method "japanese-mozc")
;;ɥ뵭ϤȤľϤڤؤ롣
;;;(define-key mozc-mode-map "$" 'YaTeX-insert-dollar-or-mozc-insert)
(define-key mozc-mode-map "\C-\o" 'YaTeX-insert-dollar-or-mozc-insert)
(defun YaTeX-insert-dollar-or-mozc-insert ()
  (interactive)
  (if (eq major-mode 'yatex-mode)
      (YaTeX-insert-dollar)
    (mozc-insert)))

[emacs] Add missing mozc config for commonized setting.


;; Time-stamp: <2015-02-24 19:38:12 kmodi>

;; Hydra
;; https://github.com/abo-abo/hydra

(use-package hydra
  ;; :load-path "elisp/hydra"
  :config
  (progn
    ;; (setq hydra-lv nil)
    (set-face-attribute 'hydra-face-red      nil :foreground "Red"        :bold t)
    (set-face-attribute 'hydra-face-blue     nil :foreground "RoyalBlue3" :bold t)
    (set-face-attribute 'hydra-face-amaranth nil :foreground "#e52b50"    :bold t)
    (set-face-attribute 'hydra-face-pink     nil :foreground "HotPink1"   :bold t)
    (set-face-attribute 'hydra-face-teal     nil :foreground "#367588"    :bold t)
    (hydra-add-font-lock)))

(provide 'setup-hydra)

;; |----------+-----------+------------------+----------------+-------------|
;; | Body     | Head      | Allows execution | Quits hydra    | Quits hydra |
;; | Color    | Inherited | of NON-HEADs     | after NON-HEAD | after HEAD  |
;; |          | Color     |                  | execution      | execution   |
;; |----------+-----------+------------------+----------------+-------------|
;; | amaranth | red       | No               | No             | No          |
;; | pink     | red       | Yes              | No             | No          |
;; | red      | red       | Yes              | Yes            | No          |
;; | teal     | blue      | No               | No             | Yes         |
;; | blue     | blue      | Yes              | Yes            | Yes         |
;; |----------+-----------+------------------+----------------+-------------|

Improve the blue of `hydra-face-blue`

Change: Improve the blue of `hydra-face-blue`

- `set-face-attribute` calls for other faces are also put here in case
  they are needed to be modified later on


;; mouse integration
(require 'mwheel)

(if (equal (getenv "TERM_PROGRAM") "iTerm.app")
    (progn
      (require 'mouse) ;; needed for iterm2 compatibility
      (message
       "********************************************************************************")
      (message "HERE")
      (message
       "********************************************************************************")
      (xterm-mouse-mode)
      (defvar mouse-wheel-progressive-speed)
      (setq mouse-wheel-progressive-speed nil)
      (defvar mouse-wheel-scroll-amount)
      (setq mouse-wheel-scroll-amount '(1))

      (mouse-wheel-mode 1)

      (declare-function cua-copy-region (arg) "cua-base.el")
      (defun smart-copy-region ()
        (interactive)
        (cua-copy-region nil)
        (shell-command-on-region
         (region-beginning)
         (region-end)
         "pbcopy")
        (message ""))
      (global-set-key (kbd "M-w") 'smart-copy-region)))

;; mouse integration
(require 'mwheel)

(when (equal (getenv "TERM_PROGRAM") "iTerm.app")
  (require 'mouse) ;; needed for iterm2 compatibility
  (xterm-mouse-mode)
  (defvar mouse-wheel-progressive-speed)
  (setq mouse-wheel-progressive-speed nil)
  (defvar mouse-wheel-scroll-amount)
  (setq mouse-wheel-scroll-amount '(1))

  (mouse-wheel-mode 1)

  (declare-function cua-copy-region (arg) "cua-base.el")
  (defun smart-copy-region ()
    (interactive)
    (cua-copy-region nil)
    (shell-command-on-region
     (region-beginning)
     (region-end)
     "pbcopy")
    (message ""))
  (global-set-key (kbd "M-w") 'smart-copy-region))

Remove debug logging, switch to using "when"


(when ds/emacs-up-to-date?
  (add-hook 'emacs-lisp-mode-hook 'prettify-symbols-mode))

;; Use double semi-colon for emacs lisp (default seems to be single).
(add-hook 'emacs-lisp-mode-hook (lambda () (setq comment-start ";;"
                                            comment-end "")))

(defun insert-key-as-kbd (key)
  (interactive "kKey: ")
  (insert (format "(kbd \"%s\")" (key-description key))))

(define-key emacs-lisp-mode-map (kbd "C-,") #'insert-key-as-kbd)

Add function to insert `kbd` commands in elisp


(setf inhibit-startup-screen t) ; disable welcome screen

(menu-bar-mode -1) ; disable menu bar

;; improve scrolling
(setf scroll-margin 5
      scroll-step 1
      scroll-conservatively 10000
      scroll-up-aggressively 0.01
      scroll-down-aggressively 0.01)

(show-paren-mode 1) ; highlight matching parens

(global-hl-line-mode 1) ; highlight current line

(setq-default indent-tabs-mode nil) ; use spaces instead of tabs

(setf inhibit-startup-screen t) ; disable welcome screen

(when (not (display-graphic-p))
  (menu-bar-mode -1)) ; disable menu bar in CLI

;; improve scrolling
(setf scroll-margin 5
      scroll-step 1
      scroll-conservatively 10000
      scroll-up-aggressively 0.01
      scroll-down-aggressively 0.01)

(show-paren-mode 1) ; highlight matching parens

(global-hl-line-mode 1) ; highlight current line

(setq-default indent-tabs-mode nil) ; use spaces instead of tabs

Make emacs menu bar disabled only in CLI