Skip to content

Commit

Permalink
General speed enhancements & mode line tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
gjstein committed Jan 21, 2017
1 parent d803ec6 commit 61e7d96
Show file tree
Hide file tree
Showing 7 changed files with 94 additions and 27 deletions.
16 changes: 7 additions & 9 deletions config/gs-org.el
Expand Up @@ -18,7 +18,7 @@

;; == bh/helper-functions ==
(defun bh/is-project-p ()
"Any task with a todo keyword subtask"
"Any task with a todo keyword subtask."
(save-restriction
(widen)
(let ((has-subtask)
Expand All @@ -33,7 +33,7 @@
(setq has-subtask t))))
(and is-a-task has-subtask))))
(defun bh/find-project-task ()
"Move point to the parent (project) task if any"
"Move point to the parent (project) task if any."
(save-restriction
(widen)
(let ((parent-task (save-excursion (org-back-to-heading 'invisible-ok) (point))))
Expand Down Expand Up @@ -96,8 +96,7 @@ Callers of this function already widen the buffer view."
("DONE" ("WAITING") ("CANCELLED") ("INACTIVE"))))

(defun gs/mark-next-done-parent-tasks-todo ()
"Visit each parent task and change NEXT (or DONE) states to TODO"

"Visit each parent task and change NEXT (or DONE) states to TODO."
;; Don't change the value if new state is "DONE"
(let ((mystate (or (and (fboundp 'org-state)
(member state
Expand All @@ -113,7 +112,7 @@ Callers of this function already widen the buffer view."

;; == Capture Mode Settings ==
;; Define the custum capture templates
(setq org-capture-templates
(defvar org-capture-templates
'(("t" "todo" entry (file org-default-notes-file)
"* TODO %?\n%u\n%a\n" :clock-in t :clock-resume t)
("b" "Blank" entry (file org-default-notes-file)
Expand Down Expand Up @@ -141,9 +140,7 @@ Callers of this function already widen the buffer view."

;; == Archive ==
(setq org-archive-location "archive/%s_archive::")
(setq org-archive-file-header-format "#+FILETAGS: ARCHIVE\nArchived entries from file %s\n")


(defvar org-archive-file-header-format "#+FILETAGS: ARCHIVE\nArchived entries from file %s\n")

;; == Habits ==
(require 'org-habit)
Expand Down Expand Up @@ -178,8 +175,9 @@ Switch projects and subprojects from NEXT back to TODO"

;; == Agenda ==

;; Dim blocked tasks
;; Dim blocked tasks (and other settings)
(setq org-enforce-todo-dependencies t)
(setq org-agenda-inhibit-startup nil)
(setq org-agenda-dim-blocked-tasks nil)

;; Compact the block agenda view (disabled)
Expand Down
65 changes: 55 additions & 10 deletions config/init-10-face.el
Expand Up @@ -64,14 +64,18 @@
(diminish 'auto-revert-mode ""))
(add-hook 'auto-revert-mode-hook 'sk/diminish-auto-revert)

;; Customize the modeline
(use-package validate :ensure t)
;;; Customize the modeline
(setq line-number-mode 1)
(setq column-number-mode 1)
(setq ns-use-srgb-colorspace nil)
(use-package spaceline-config
:ensure spaceline
:config
;; Set some parameters of the spaceline
(setq spaceline-highlight-face-func 'spaceline-highlight-face-evil-state)
(setq powerline-default-separator 'bar)

;; Define a better buffer position line
(spaceline-define-segment gjstein-buffer-position
"a better buffer position display"
(let ((buffer-position (format-mode-line "%p")))
Expand All @@ -81,7 +85,8 @@
"%p")))
)
)
(setq spaceline-highlight-face-func 'spaceline-highlight-face-evil-state)

;; Removes the " Git:" from the 'version-control' segment.
(spaceline-define-segment gjstein-version-control
"Version control information."
(when vc-mode
Expand All @@ -100,28 +105,68 @@
(`needs-update " Upd")
(`ignored "!")
(_ " Unk"))))))))


;; Makes a shorter org-clock string.
(defun gjstein-org-clock-get-clock-string ()
"Makes a clock string for org."
(let ((clocked-time (org-clock-get-clocked-time)))
(if org-clock-effort
(let* ((effort-in-minutes
(org-duration-string-to-minutes org-clock-effort))
(work-done-str
(propertize
(org-minutes-to-clocksum-string clocked-time)
'face (if (and org-clock-task-overrun (not org-clock-task-overrun-text))
'org-mode-line-clock-overrun 'org-mode-line-clock)))
(effort-str (org-minutes-to-clocksum-string effort-in-minutes))
(clockstr (propertize
(concat "%s/" effort-str
" " (replace-regexp-in-string "%" "%%" org-clock-heading))
'face 'org-mode-line-clock)))
(format clockstr work-done-str))
(propertize (concat (org-minutes-to-clocksum-string clocked-time)
(format " %s" org-clock-heading))
'face 'org-mode-line-clock))))
(setq spaceline-org-clock-format-function 'gjstein-org-clock-get-clock-string)

(spaceline-compile
'gjstein
;; Left side of the mode line (all the important stuff)
'(((buffer-modified buffer-size input-method) :face highlight-face)
'(buffer-id remote-host major-mode)
((point-position line-column gjstein-buffer-position) :separator "|" )
process
(org-clock)
((flycheck-error flycheck-warning flycheck-info) :when active)
((flycheck-error flycheck-warning flycheck-info) :separator "" :when active)
((which-function projectile-root (gjstein-version-control :when active)) :separator ":")
)
;; Right segment (the unimportant stuff)
'((minor-modes :separator spaceline-minor-modes-separator) :when active))
'((org-clock)
(minor-modes :separator " ") :when active))

(spaceline-helm-mode)
(setq-default mode-line-format '("%e" (:eval (spaceline-ml-gjstein)))))

(use-package powerline
:ensure t
:after spaceline-config
:config (validate-setq
powerline-height (truncate (* 1.0 (frame-char-height)))
powerline-default-separator 'utf-8))
:config
(setq
powerline-height (truncate (* 1.0 (frame-char-height)))
powerline-default-separator 'utf-8)
)

(defmacro rename-major-mode (package-name mode new-name)
"Renames a major mode."
`(eval-after-load ,package-name
'(defadvice ,mode (after rename-modeline activate)
(setq mode-name ,new-name))))
(rename-major-mode "python" python-mode "π")
(rename-major-mode "markdown-mode" markdown-mode "Md")
(rename-major-mode "shell" shell-mode "σ")
(rename-major-mode "org" org-mode "ω")
(rename-major-mode "Web" web-mode "w")

(add-hook 'web-mode-hook (lambda() (setq mode-name "w")))
(add-hook 'emacs-lisp-mode-hook (lambda() (setq mode-name "ελ")))

;;; init-10-face.el ends here
6 changes: 5 additions & 1 deletion config/init-20-nav-interface.el
Expand Up @@ -27,7 +27,11 @@
(global-evil-leader-mode)
(evil-leader/set-leader "<SPC>")
(evil-leader/set-key "c" 'org-capture)
(evil-leader/set-key "a" 'org-agenda)
(defun gjstein-org-agenda ()
"Open my custom agenda"
(interactive)
(org-agenda 0 " "))
(evil-leader/set-key "a" 'gjstein-org-agenda)
(evil-leader/set-key "g" 'magit-status)
)

Expand Down
11 changes: 11 additions & 0 deletions config/init-31-doc-org.el
Expand Up @@ -104,6 +104,17 @@
"i" 'org-clock-in
"o" 'org-clock-out
)

;; some functions for timing
)

(defun org-build-agenda ()
(interactive)
(setq last-build-time (format-time-string "%S.%3N"))
(org-agenda 0 " ")
(setq after-build-time (format-time-string "%S.%3N"))
(print last-build-time)
(print after-build-time)
)

;;; init-31-doc-org.el ends here
14 changes: 10 additions & 4 deletions config/init-40-coding-gen.el
Expand Up @@ -38,7 +38,6 @@
:bind ("C-;" . company-complete-common)
)


;; === Tools ===

;; == YASnippet ==
Expand All @@ -57,7 +56,9 @@
(projectile-mode)
(use-package helm-projectile
:ensure t
:init
:defer t
:after helm
:config
(helm-projectile-on)
(evil-leader/set-key "s" 'helm-projectile-ag)
)
Expand All @@ -68,19 +69,23 @@
;; Note that 'ag' (the silver searcher) needs to be installed.
;; Ubuntu: sudo apt-get install ag
;; OSX: brew install ag

(use-package ag
:ensure t
:defer t
)

(use-package helm-ag
:ensure t
:defer t
:after helm
)

;; == compile ==

;; https://emacs.stackexchange.com/questions/8135/why-does-compilation-buffer-show-control-characters
(use-package ansi-color
:ensure t
:defer t
:config (progn
(defun my/ansi-colorize-buffer ()
(let ((buffer-read-only nil))
Expand All @@ -91,6 +96,7 @@
;; == evil + vimish-fold ==
(use-package evil-vimish-fold
:ensure t
:defer t
:init
(evil-vimish-fold-mode 1)
:diminish evil-vimish-fold-mode
Expand All @@ -105,6 +111,7 @@
(setq magit-diff-options (quote ("--word-diff")))
(setq magit-diff-refine-hunk 'all)
;; Use evil keybindings within magit
:config
(use-package evil-magit
:ensure t
:config
Expand Down Expand Up @@ -136,7 +143,6 @@
)))
(add-hook 'c++-mode-hook (lambda () (setq flycheck-clang-language-standard "c++11")))
(setq-default flycheck-disabled-checkers '(c/c++-clang c/c++-gcc))

)

;; == OTHER LANGUAGES ==
Expand Down
4 changes: 2 additions & 2 deletions config/init-44-coding-python.el
Expand Up @@ -24,8 +24,8 @@
;; pip install yapf
(use-package elpy
:ensure t
:defer t
:init
:after python
:config
(elpy-enable)
)

Expand Down
5 changes: 4 additions & 1 deletion init.el
Expand Up @@ -56,6 +56,9 @@
(require 'diminish) ;; if you use :diminish
(require 'bind-key) ;; if you use any :bind variant

;; Increase garbage collection threshold to 500 MB to ease startup
(setq gc-cons-threshold (* 500 1024 1024))

;; Set the path variable
(use-package exec-path-from-shell
:ensure t
Expand Down Expand Up @@ -98,7 +101,7 @@
'(flycheck-google-cpplint-verbose "3")
'(package-selected-packages
(quote
(smart-mode-line evil-surround evil-extra-operator evil-vimish-fold evil-magit evil scss-mode flymake-sass sass-mode less-css-mode ledger-mode flycheck-rust rust-mode yaml-mode elpy matlab-mode emmet-mode web-mode cmake-mode flycheck-google-cpplint google-c-style helm-gtags swift-mode flycheck magit helm-ag ag helm-projectile projectile yasnippet company-irony company auctex markdown-mode helm color-theme-solarized color-theme exec-path-from-shell use-package))))
(esup cyphejor smart-mode-line evil-surround evil-extra-operator evil-vimish-fold evil-magit evil scss-mode flymake-sass sass-mode less-css-mode ledger-mode flycheck-rust rust-mode yaml-mode elpy matlab-mode emmet-mode web-mode cmake-mode flycheck-google-cpplint google-c-style helm-gtags swift-mode flycheck magit helm-ag ag helm-projectile projectile yasnippet company-irony company auctex markdown-mode helm color-theme-solarized color-theme exec-path-from-shell use-package))))
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
Expand Down

0 comments on commit 61e7d96

Please sign in to comment.