Skip to content

Commit

Permalink
some simplifications
Browse files Browse the repository at this point in the history
  • Loading branch information
tdfirth committed Apr 25, 2020
1 parent dfbc58e commit 41a4738
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 34 deletions.
1 change: 1 addition & 0 deletions init.el
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
(require 'packages)
(require 'keybindings)
(require 'lang)
(require 'org)

;; Reset gc for normal use.
(setq gc-cons-threshold 16777216)
Expand Down
1 change: 0 additions & 1 deletion modules/appearance.el
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
(setq select-enable-clipboard t)

(global-hl-line-mode +1)
;; (global-display-line-numbers-mode)
(column-number-mode t)
(size-indication-mode t)

Expand Down
23 changes: 2 additions & 21 deletions modules/lang.el
Original file line number Diff line number Diff line change
Expand Up @@ -64,37 +64,18 @@
;; rs
(use-package rust-mode)

(defun tdf/cargo-process-run ()
"Build and run Rust code."
(interactive)
(cargo-process-run)
(let ((orig-win (selected-window))
(run-win
(display-buffer (get-buffer "*Cargo Run*") nil 'visible)))
(select-window run-win)
(comint-mode)
(read-only-mode 0)
(select-window orig-win)))

(tdf/add-formatter 'rust-mode 'lsp-format-buffer)

(tdf/define-ctrl-c-keys
:keymaps 'rust-mode-map
"C-m r" '(tdf/cargo-process-run :which-key "run")
"C-m b" '(cargo-process-build :which-key "build")
"C-t t" '(cargo-process-current-test :which-key "current")
"C-t f" '(cargo-process-current-file-tests :which-key "file")
"C-t p" '(cargo-process-test :which-key "project")
)

(use-package cargo
:hook (rust-mode . cargo-minor-mode))

(use-package flycheck-rust
:config (add-hook 'flycheck-mode-hook #'flycheck-rust-setup))

(tdf/lang-hook 'rust-mode-hook
(setq indent-tabs-mode nil)
;; (setq indent-tabs-mode nil)
(setq tab-width 4)
(lsp))

;; ocaml
Expand Down
76 changes: 76 additions & 0 deletions modules/org-config.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
;;; org.el --- OrgMode.
;;; Commentary:
;;; Config for org mode
;;; Code:

;; Install cutting-edge version of org-mode, and from a mirror, because
;; code.orgmode.org runs on a potato.
;; https://github.com/emacs-straight/org-mode
;; (use-package org-mode
;; :ensure t
;; :recipe (:host github
;; :repo "emacs-straight/org-mode"
;; :files ("*.el" "lisp/*.el" "contrib/lisp/*.el"))
;; :pin "30d0b6e1f6")
;; ...And prevent other packages from pulling org; org-plus-contrib satisfies
;; the dependency already: https://github.com/raxod502/straight.el/issues/352
;; (use-package org
;; :recipe (:local-repo nil))
(setq org-indirect-buffer-display 'current-window
org-eldoc-breadcrumb-separator ""
org-enforce-todo-dependencies t
org-fontify-done-headline t
org-fontify-quote-and-verse-blocks t
org-fontify-whole-heading-line t
org-footnote-auto-label 'plain
org-hide-leading-stars t
org-hide-leading-stars-before-indent-mode t
org-image-actual-width nil
org-list-description-max-indent 4
org-priority-faces
'((?A . error)
(?B . warning)
(?C . success))
org-startup-indented t
org-tags-column 0
org-use-sub-superscripts '{}
org-pretty-entities t)

(setq org-refile-targets
'((nil :maxlevel . 3)
(org-agenda-files :maxlevel . 3))
;; Without this, completers like ivy/helm are only given the first level of
;; each outline candidates. i.e. all the candidates under the "Tasks" heading
;; are just "Tasks/". This is unhelpful. We want the full path to each refile
;; target! e.g. FILE/Tasks/heading/subheading
org-refile-use-outline-path 'file
org-outline-path-complete-in-steps nil)

;; HACK Face specs fed directly to `org-todo-keyword-faces' don't respect
;; underlying faces like the `org-todo' face does, so we define our own
;; intermediary faces that extend from org-todo.
(with-no-warnings
(custom-declare-face '+org-todo-active '((t (:inherit (bold font-lock-constant-face org-todo)))) "")
(custom-declare-face '+org-todo-project '((t (:inherit (bold font-lock-doc-face org-todo)))) "")
(custom-declare-face '+org-todo-onhold '((t (:inherit (bold warning org-todo)))) ""))
(setq org-todo-keywords
'((sequence
"TODO(t)" ; A task that needs doing & is ready to do
"PROJ(p)" ; An ongoing project that cannot be completed in one step
"STRT(s)" ; A task that is in progress
"WAIT(w)" ; Something is holding up this task; or it is paused
"|"
"DONE(d)" ; Task successfully completed
"KILL(k)") ; Task was cancelled, aborted or is no longer applicable
(sequence
"[ ](T)" ; A task that needs doing
"[-](S)" ; Task is in progress
"[?](W)" ; Task is being held up or paused
"|"
"[X](D)")) ; Task was completed
org-todo-keyword-faces
'(("[-]" . +org-todo-active)
("STRT" . +org-todo-active)
("[?]" . +org-todo-onhold)
("WAIT" . +org-todo-onhold)
("PROJ" . +org-todo-project)))
23 changes: 11 additions & 12 deletions modules/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
(package-initialize)

(defvar tdf/packages '(
cargo
company
company-lsp
counsel-projectile
Expand Down Expand Up @@ -230,17 +229,17 @@

(setq split-height-threshold 0)
(setq compilation-window-height 10)
(defun tdf/resize-compilation-buffer ()
"Resizes the compilation buffer regardless of window arrangement."
(when (not (get-buffer-window "*compilation*"))
(save-selected-window
(save-excursion
(let* ((w (split-window-vertically))
(h (window-height w)))
(select-window w)
(switch-to-buffer "*compilation*")
(shrink-window (- h compilation-window-height)))))))
(add-hook 'compilation-mode-hook 'tdf/resize-compilation-buffer)
;; (defun tdf/resize-compilation-buffer ()
;; "Resizes the compilation buffer regardless of window arrangement."
;; (when (not (get-buffer-window "*compilation*"))
;; (save-selected-window
;; (save-excursion
;; (let* ((w (split-window-vertically))
;; (h (window-height w)))
;; (select-window w)
;; (switch-to-buffer "*compilation*")
;; (shrink-window (- h compilation-window-height)))))))
;; (add-hook 'compilation-mode-hook 'tdf/resize-compilation-buffer)


(provide 'packages)
Expand Down

0 comments on commit 41a4738

Please sign in to comment.