diff --git a/init.el b/init.el index 7a537f02..cc77914b 100644 --- a/init.el +++ b/init.el @@ -370,7 +370,7 @@ The current directory is assumed to be the project's root otherwise." ;; Make mouse scrolling less jumpy. (setq mouse-wheel-scroll-amount '(1 ((shift) . 1))) -(eval-after-load "subword-mode" '(progn (diminish 'subword-mode))) +(eval-after-load "subword-mode" '(diminish 'subword-mode)) (use-package load-dir :ensure t @@ -414,6 +414,7 @@ The current directory is assumed to be the project's root otherwise." (progn (use-package ace-window :ensure t + :config (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l)) :bind ("C-c w" . ace-select-window))) :config (progn @@ -543,6 +544,16 @@ The current directory is assumed to be the project's root otherwise." ;; Non-Programming Stuff ;; ============================================================================= +(use-package helm-spotify + :ensure t + :commands helm-spotify) + +(use-package edit-server + :ensure t + :disabled t + :commands edit-server-start + :idle (edit-server-start)) + (use-package jabber :ensure t :commands jabber-connect @@ -570,6 +581,8 @@ The current directory is assumed to be the project's root otherwise." ("C-c C-S-t" . org-todo-no-note)) :config (progn + (setq org-habit-graph-column 50) + (setq org-habit-show-habits-only-for-today nil) (unless (boundp 'org-gtd-file) (defvar org-gtd-file "~/org/gtd.org")) (unless (boundp 'org-habits-file) @@ -797,7 +810,6 @@ The current directory is assumed to be the project's root otherwise." :idle-priority 1 :config (progn - (message "Setting up projectile.") (projectile-global-mode) (setq projectile-enable-caching t) (setq projectile-completion-system 'helm) @@ -816,6 +828,7 @@ The current directory is assumed to be the project's root otherwise." (use-package smex :ensure t + :disabled t :commands smex ;; This is here because smex feels like part of ido :bind ("M-x" . smex)) diff --git a/load.d/helm-org-headlines.el b/load.d/helm-org-headlines.el new file mode 100644 index 00000000..32154580 --- /dev/null +++ b/load.d/helm-org-headlines.el @@ -0,0 +1,46 @@ +(defun helm-org-agenda-files-headlines (&optional min-depth max-depth) + (interactive) + (helm :sources (helm-source-org-headlines-for-files org-agenda-files))) + + +(defun helm-org-goto-marker (marker) + (switch-to-buffer (marker-buffer marker)) + (goto-char (marker-position marker)) + (org-show-entry)) + + +(defun helm-source-org-headlines-for-files (filenames &optional min-depth max-depth) + (unless min-depth (setq min-depth 1)) + (unless max-depth (setq max-depth 8)) + (helm-build-sync-source "Org Headlines" + :candidates (helm-org-get-candidates filenames) + :action 'helm-org-goto-marker + :action-transformer + (lambda (actions candidate) + '(("Go to line" . helm-org-goto-marker) + ("Refile to this headline" . helm-org-headline-refile) + ("Insert link to this headline" + . helm-org-headline-insert-link-to-headline))))) + +(defun helm-org-headline-refile (marker) + (with-helm-current-buffer + (org-cut-subtree)) + (helm-org-goto-marker marker) + (goto-char (marker-position marker)) + (let (destination-level (org-current-level)) + (org-end-of-subtree t t) + (org-paste-subtree (+ destination-level 1)))) + +(defun helm-org-get-candidates (filenames) + (-flatten + (mapcar (lambda (filename) + (helm-get-org-candidates-in-file + filename min-depth max-depth)) + org-agenda-files))) + +(defun helm-get-org-candidates-in-file (filename min-depth max-depth) + (with-current-buffer (find-file-noselect filename) + (save-excursion + (beginning-of-buffer) + (cl-loop while (re-search-forward org-complex-heading-regexp nil t) + collect `(,(match-string-no-properties 0) . ,(point-marker))))))