Skip to content

Commit

Permalink
Switch to use-package' for ublt-editing'
Browse files Browse the repository at this point in the history
  • Loading branch information
ubolonton committed Apr 24, 2019
1 parent e3e5cc7 commit 469b448
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 41 deletions.
76 changes: 43 additions & 33 deletions config/ublt-editing.el
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@


;;; Move line/region up/down
(use-package move-text)

(ublt/set-up 'move-text)


(defun ublt/unfill-paragraph ()
"Does the inverse of `fill-paragraph', by calling it with
Expand All @@ -14,8 +15,7 @@


;;; Cycling and extending selection

(ublt/set-up 'expand-region)
(use-package expand-region)


;;; Toggle CUA mode, starting CUA rect if turning on
Expand Down Expand Up @@ -72,12 +72,12 @@ See `http://ergoemacs.org/emacs/modernization_upcase-word.html'


;;; Copy/cut/duplicate whole line if no region is selected
(ublt/set-up 'whole-line-or-region
(defun ublt/duplicate-line (prefix)
(interactive "p")
;; FIX: This looks dirty
(call-interactively 'whole-line-or-region-kill-ring-save)
(call-interactively 'whole-line-or-region-yank)))
(use-package whole-line-or-region
:config (defun ublt/duplicate-line (prefix)
(interactive "p")
;; FIX: This looks dirty
(call-interactively 'whole-line-or-region-kill-ring-save)
(call-interactively 'whole-line-or-region-yank)))


;; Prefer UTF-8
Expand All @@ -90,14 +90,16 @@ See `http://ergoemacs.org/emacs/modernization_upcase-word.html'
locale-coding-system 'utf-8
x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
(define-coding-system-alias 'UTF-8 'utf-8)
(ublt/set-up 'htmlize
(setq htmlize-html-charset "utf-8"))
(use-package htmlize
:custom (htmlize-html-charset "utf-8"))
;;; TODO: Test this in Windows. If it works, use `ublt/in'
;;(set-clipboard-coding-system 'utf-16le-dos)


;;; Paredit ----------------------------------------------------------
(ublt/set-up 'paredit
;;; Structural editing with ()[]{}.
(use-package paredit
:config
;; (defun ublt/enable-paredit-mode ()
;; "Enable paredit-mode without checking paren balance."
;; (let ((current-prefix-arg t))
Expand Down Expand Up @@ -146,33 +148,40 @@ See `http://ergoemacs.org/emacs/modernization_upcase-word.html'

;;; Automatic completion

(ublt/set-up 'company
(setq company-idle-delay 0.3
company-minimum-prefix-length 2
company-require-match nil
company-tooltip-flip-when-above t
company-frontends '(company-pseudo-tooltip-frontend
company-preview-frontend)
company-tooltip-align-annotations t
company-selection-wrap-around t
company-transformers '(company-sort-by-occurrence))
(ublt/set-up 'company-box
(add-hook 'company-mode-hook 'company-box-mode))
(global-company-mode +1))
(use-package company
:custom ((company-idle-delay 0.3)
(company-minimum-prefix-length 2)
(company-require-match nil)
(company-tooltip-flip-when-above t)
(company-frontends '(company-pseudo-tooltip-frontend
company-preview-frontend))
(company-tooltip-align-annotations t)
(company-selection-wrap-around t)
(company-transformers '(company-sort-by-occurrence)))
:config (global-company-mode +1))

(use-package company-box
:hook (company-mode . company-box-mode))


;;; Yasnippet --------------------------------------------------------

(ublt/set-up 'yasnippet
(setq yas-choose-keys-first t)
(use-package yasnippet
:custom (yas-choose-keys-first t)
;; Don't, use a dedicate key binding for yas
;; (add-to-list 'hippie-expand-try-functions-list 'yas-hippie-try-expand)
:config
(add-to-list 'yas-snippet-dirs "~/.emacs.d/data/yasnippet/snippets")
(yas-global-mode +1))

(use-package yasnippet-snippets)


;;; Misc

;;; Recompile Emacs Lisp on-save.
(use-package auto-compile)

;;; TODO: Use this
(defun ublt/remove-hard-wrap ()
;;; TODO: Unfill paragraphs one-by-one, skipping those that should not
Expand Down Expand Up @@ -215,17 +224,18 @@ See `http://ergoemacs.org/emacs/modernization_upcase-word.html'
(setq-default tab-width 4)

;; Teh awesome
(ublt/set-up 'undo-tree
(global-undo-tree-mode))
(use-package undo-tree
:config (global-undo-tree-mode +1))

;; Automatically update files whose contents were changed
(global-auto-revert-mode +1)
;; (setq auto-revert-check-vc-info t)

;; emacs-mac-app https://bitbucket.org/mituharu/emacs-mac
(setq
mac-command-modifier 'super
mac-option-modifier 'meta
mac-pass-command-to-system nil)
(ublt/in '(darwin)
(setq
mac-command-modifier 'super
mac-option-modifier 'meta
mac-pass-command-to-system nil))

(provide 'ublt-editing)
9 changes: 1 addition & 8 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,16 @@
(defvar ublt/packages
'(use-package
dash
auto-compile ;recompile Emacs Lisp on-save
company company-box
yasnippet
yasnippet-snippets
textmate undo-tree whole-line-or-region
textmate
avy keyfreq
ag
expand-region
popwin ; make unimportant windows transient
move-text ; move selected/current lines up/down
org org-bullets
ox-reveal ; reveal.js slides from org-mode
adaptive-wrap
;; TODO: Use & combine with eproject
projectile ; Project management
emms ; Music
paredit ; Structural editing with ()[]{}
exec-path-from-shell ; Uhm, f*ck shell
pabbrev ; TODO: Find better alternative
;; Vim emulation
Expand Down

0 comments on commit 469b448

Please sign in to comment.