more cleaning

This commit is contained in:
petrucci4prez 2018-05-19 15:09:15 -04:00
parent a574085746
commit 3f55f7bac0
2 changed files with 98 additions and 102 deletions

14
conf.el
View File

@ -312,8 +312,6 @@ event of an error or nonlocal exit."
(advice-add #'org-fast-tag-selection :around #'nd/org-tag-window-advice) (advice-add #'org-fast-tag-selection :around #'nd/org-tag-window-advice)
;;(add-hook 'org-capture-mode-hook 'evil-append)
(setq org-src-window-setup 'current-window) (setq org-src-window-setup 'current-window)
(setq org-src-fontify-natively t) (setq org-src-fontify-natively t)
(setq org-edit-src-content-indentation 0) (setq org-edit-src-content-indentation 0)
@ -350,12 +348,12 @@ event of an error or nonlocal exit."
(sequence "WAIT(w@/!)" "HOLD(h@/!)" "|" "CANC(c@/!)"))) (sequence "WAIT(w@/!)" "HOLD(h@/!)" "|" "CANC(c@/!)")))
(setq org-todo-keyword-faces (setq org-todo-keyword-faces
(quote (("TODO" :foreground "light coral" :weight bold) '(("TODO" :foreground "light coral" :weight bold)
("NEXT" :foreground "khaki" :weight bold) ("NEXT" :foreground "khaki" :weight bold)
("DONE" :foreground "light green" :weight bold) ("DONE" :foreground "light green" :weight bold)
("WAIT" :foreground "orange" :weight bold) ("WAIT" :foreground "orange" :weight bold)
("HOLD" :foreground "violet" :weight bold) ("HOLD" :foreground "violet" :weight bold)
("CANC" :foreground "deep sky blue" :weight bold)))) ("CANC" :foreground "deep sky blue" :weight bold)))
(defun nd/filter-list-prefix (prefix str-list) (defun nd/filter-list-prefix (prefix str-list)
"Return a subset of tags-list whose first character matches prefix.' "Return a subset of tags-list whose first character matches prefix.'

186
conf.org
View File

@ -288,6 +288,16 @@ event of an error or nonlocal exit."
`(advice-remove ,(car adform) ,(nth 2 adform))) `(advice-remove ,(car adform) ,(nth 2 adform)))
adlist)))) adlist))))
#+END_SRC #+END_SRC
** functions
#+BEGIN_SRC emacs-lisp
(defun nd/filter-list-prefix (prefix str-list)
"Return a subset of tags-list whose first character matches prefix.'
tags-list defaults to org-tag-alist if not given"
(seq-filter (lambda (i)
(and (stringp i)
(string-prefix-p prefix i)))
str-list))
#+END_SRC
* custom functions * custom functions
** follow window splitting ** follow window splitting
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -392,10 +402,10 @@ event of an error or nonlocal exit."
* org-mode * org-mode
** basic ** basic
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq org-log-done t) (setq org-log-done t)
(setq org-startup-indented t) (setq org-startup-indented t)
(delight 'org-indent-mode) (delight 'org-indent-mode)
(setq org-directory "~/Org") (setq org-directory "~/Org")
#+END_SRC #+END_SRC
** ui ** ui
*** bullets *** bullets
@ -423,47 +433,43 @@ Org mode is great and all, but the windows never show up in the right place
**** todo selection **** todo selection
I only need a teeny tiny window below my current window for todo selection I only need a teeny tiny window below my current window for todo selection
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun nd/org-todo-position (buffer alist) (defun nd/org-todo-position (buffer alist)
(let ((win (car (cl-delete-if-not (let ((win (car (cl-delete-if-not
(lambda (window) (lambda (window)
(with-current-buffer (window-buffer window) (with-current-buffer (window-buffer window)
(memq major-mode (memq major-mode
'(org-mode org-agenda-mode)))) '(org-mode org-agenda-mode))))
(window-list))))) (window-list)))))
(when win (when win
(let ((new (split-window win -4 'below))) (let ((new (split-window win -4 'below)))
(set-window-buffer new buffer) (set-window-buffer new buffer)
new)))) new))))
(defun nd/org-todo-window-advice (orig-fn) (defun nd/org-todo-window-advice (orig-fn)
"Advice to fix window placement in `org-fast-todo-selection'." "Advice to fix window placement in `org-fast-todo-selection'."
(let ((override '("\\*Org todo\\*" nd/org-todo-position))) (let ((override '("\\*Org todo\\*" nd/org-todo-position)))
(add-to-list 'display-buffer-alist override) (add-to-list 'display-buffer-alist override)
(nd/with-advice (nd/with-advice
((#'org-switch-to-buffer-other-window :override #'pop-to-buffer)) ((#'org-switch-to-buffer-other-window :override #'pop-to-buffer))
(unwind-protect (funcall orig-fn) (unwind-protect (funcall orig-fn)
(setq display-buffer-alist (setq display-buffer-alist
(delete override display-buffer-alist)))))) (delete override display-buffer-alist))))))
(advice-add #'org-fast-todo-selection :around #'nd/org-todo-window-advice) (advice-add #'org-fast-todo-selection :around #'nd/org-todo-window-advice)
#+END_SRC #+END_SRC
**** tag selection **** tag selection
By default, the tag selection window obliterates all but the current window...how disorienting :/ By default, the tag selection window obliterates all but the current window...how disorienting :/
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun nd/org-tag-window-advice (orig-fn current inherited table &optional todo-table) (defun nd/org-tag-window-advice (orig-fn current inherited table &optional todo-table)
"Advice to fix window placement in `org-fast-tags-selection'." "Advice to fix window placement in `org-fast-tags-selection'."
(nd/with-advice (nd/with-advice
((#'delete-other-windows :override #'ignore) ((#'delete-other-windows :override #'ignore)
;; pretty sure I just got lucky here... ;; pretty sure I just got lucky here...
(#'split-window-vertically :override #'(lambda (&optional size) (#'split-window-vertically :override #'(lambda (&optional size)
(split-window-below (or size -9))))) (split-window-below (or size -9)))))
(unwind-protect (funcall orig-fn current inherited table todo-table)))) (unwind-protect (funcall orig-fn current inherited table todo-table))))
(advice-add #'org-fast-tag-selection :around #'nd/org-tag-window-advice) (advice-add #'org-fast-tag-selection :around #'nd/org-tag-window-advice)
#+END_SRC
** evil modes
#+BEGIN_SRC emacs-lisp
;;(add-hook 'org-capture-mode-hook 'evil-append)
#+END_SRC #+END_SRC
** src ** src
*** basic *** basic
@ -511,19 +517,19 @@ By default, the tag selection window obliterates all but the current window...ho
** todo states ** todo states
*** sequences *** sequences
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq org-todo-keywords (setq org-todo-keywords
'((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)") '((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d)")
(sequence "WAIT(w@/!)" "HOLD(h@/!)" "|" "CANC(c@/!)"))) (sequence "WAIT(w@/!)" "HOLD(h@/!)" "|" "CANC(c@/!)")))
#+END_SRC #+END_SRC
*** colors *** colors
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(setq org-todo-keyword-faces (setq org-todo-keyword-faces
(quote (("TODO" :foreground "light coral" :weight bold) '(("TODO" :foreground "light coral" :weight bold)
("NEXT" :foreground "khaki" :weight bold) ("NEXT" :foreground "khaki" :weight bold)
("DONE" :foreground "light green" :weight bold) ("DONE" :foreground "light green" :weight bold)
("WAIT" :foreground "orange" :weight bold) ("WAIT" :foreground "orange" :weight bold)
("HOLD" :foreground "violet" :weight bold) ("HOLD" :foreground "violet" :weight bold)
("CANC" :foreground "deep sky blue" :weight bold)))) ("CANC" :foreground "deep sky blue" :weight bold)))
#+END_SRC #+END_SRC
** tags ** tags
I use tags for agenda filtering. Very fast and simple. I use tags for agenda filtering. Very fast and simple.
@ -536,56 +542,48 @@ There are several types of tags I use:
- attribute: useful flags for filtering; these start with "%" - attribute: useful flags for filtering; these start with "%"
- life areas: key areas of life which define priorities and goals; these start with "_" - life areas: key areas of life which define priorities and goals; these start with "_"
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun nd/filter-list-prefix (prefix str-list) (defun nd/add-tag-face (fg-name prefix)
"Return a subset of tags-list whose first character matches prefix.' "Adds list of cons cells to org-tag-faces with foreground set to fg-name.
tags-list defaults to org-tag-alist if not given" Start and end specify the positions in org-tag-alist which define the tags
(seq-filter (lambda (i) to which the faces are applied"
(and (stringp i) (dolist (tag (nd/filter-list-prefix prefix (mapcar #'car org-tag-alist)))
(string-prefix-p prefix i))) (push `(,tag . (:foreground ,fg-name)) org-tag-faces)))
str-list))
(defun nd/add-tag-face (fg-name prefix) ;; for some reason, most special chars don't really
"Adds list of cons cells to org-tag-faces with foreground set to fg-name. ;; work in org-tag-alist, only #, @, %, and _
Start and end specify the positions in org-tag-alist which define the tags (setq org-tag-alist
to which the faces are applied" '((:startgroup)
(dolist (tag (nd/filter-list-prefix prefix (mapcar #'car org-tag-alist))) ("@errand" . ?e)
(push `(,tag . (:foreground ,fg-name)) org-tag-faces))) ("@home" . ?h)
("@work" . ?w)
("@travel" . ?t)
(:endgroup)
("#laptop" . ?L)
("#tcult" . ?T)
("#phone" . ?O)
("%note" . ?n)
("%inc" . ?i)
("%subdiv" . ?s)
(:startgroup)
("_env" . ?E)
("_fin" . ?F)
("_int" . ?I)
("_met" . ?M)
("_phy" . ?H)
("_pro" . ?P)
("_rec" . ?R)
("_soc" . ?S)
(:endgroup)))
;; for some reason, most special chars don't really (setq org-tag-faces '())
;; work in org-tag-alist, only #, @, %, and _
(setq org-tag-alist
'((:startgroup)
("@errand" . ?e)
("@home" . ?h)
("@work" . ?w)
("@travel" . ?t)
(:endgroup)
("#laptop" . ?L)
("#tcult" . ?T)
("#phone" . ?O)
("%note" . ?n)
("%inc" . ?i)
("%subdiv" . ?s)
(:startgroup)
("_env" . ?E)
("_fin" . ?F)
("_int" . ?I)
("_met" . ?M)
("_phy" . ?H)
("_pro" . ?P)
("_rec" . ?R)
("_soc" . ?S)
(:endgroup)))
(setq org-tag-faces '()) (nd/add-tag-face "PaleGreen" "@")
(nd/add-tag-face "SkyBlue" "#")
(nd/add-tag-face "PaleGreen" "@") (nd/add-tag-face "PaleGoldenrod" "%")
(nd/add-tag-face "SkyBlue" "#") (nd/add-tag-face "violet" "_")
(nd/add-tag-face "PaleGoldenrod" "%")
(nd/add-tag-face "violet" "_")
#+END_SRC #+END_SRC
** properties ** properties