diff options
author | Case Duckworth | 2021-09-27 18:21:03 -0500 |
---|---|---|
committer | Case Duckworth | 2021-09-27 18:21:03 -0500 |
commit | acd28edf7129eb32b95ae0ab8b83276bf3721360 (patch) | |
tree | bdc69ddc3ea1896ca7ca30a5ebd8427fa0532f83 | |
parent | Add circe-buffer-source (diff) | |
download | emacs-acd28edf7129eb32b95ae0ab8b83276bf3721360.tar.gz emacs-acd28edf7129eb32b95ae0ab8b83276bf3721360.zip |
Add consult-org-clock
... or whatever it's called.
-rw-r--r-- | init.el | 118 |
1 files changed, 77 insertions, 41 deletions
diff --git a/init.el b/init.el index 6620f45..f24f1c7 100644 --- a/init.el +++ b/init.el | |||
@@ -1838,47 +1838,46 @@ browser defined in `browse-url-secondary-browser-function'." | |||
1838 | org-contrib) | 1838 | org-contrib) |
1839 | (:also-load acdw-org) | 1839 | (:also-load acdw-org) |
1840 | (require 'chd nil 'noerror) | 1840 | (require 'chd nil 'noerror) |
1841 | (:option | 1841 | (:option org-adapt-indentation nil |
1842 | org-adapt-indentation nil | 1842 | org-agenda-files nil ; only until I set this up |
1843 | org-agenda-files nil ; only until I set this up | 1843 | org-catch-invisible-edits 'show-and-error |
1844 | org-catch-invisible-edits 'show-and-error | 1844 | org-clock-clocked-in-display 'frame-title |
1845 | org-clock-clocked-in-display 'frame-title | 1845 | org-clock-frame-title-format (cons '(t org-mode-line-string) |
1846 | org-clock-frame-title-format (cons '(t org-mode-line-string) | 1846 | (cons " --- " frame-title-format)) |
1847 | (cons " --- " frame-title-format)) | 1847 | ;;org-clock-string-limit 7 ; gives time and not title |
1848 | ;;org-clock-string-limit 7 ; gives time and not title | 1848 | org-clock-persist t |
1849 | org-confirm-babel-evaluate nil | 1849 | org-confirm-babel-evaluate nil |
1850 | org-cycle-separator-lines 0 | 1850 | org-cycle-separator-lines 0 |
1851 | org-directory "~/org" | 1851 | org-directory "~/org" |
1852 | org-ellipsis " …" | 1852 | org-ellipsis " …" |
1853 | org-export-coding-system 'utf-8-unix | 1853 | org-export-coding-system 'utf-8-unix |
1854 | org-export-headline-levels 8 | 1854 | org-export-headline-levels 8 |
1855 | org-export-with-section-numbers nil | 1855 | org-export-with-section-numbers nil |
1856 | org-export-with-smart-quotes t | 1856 | org-export-with-smart-quotes t |
1857 | org-export-with-sub-superscripts t | 1857 | org-export-with-sub-superscripts t |
1858 | org-export-with-toc nil | 1858 | org-export-with-toc nil |
1859 | org-fontify-done-headline t | 1859 | org-fontify-done-headline t |
1860 | org-fontify-quote-and-verse-blocks t | 1860 | org-fontify-quote-and-verse-blocks t |
1861 | org-fontify-whole-heading-line t | 1861 | org-fontify-whole-heading-line t |
1862 | org-hide-emphasis-markers t | 1862 | org-hide-emphasis-markers t |
1863 | org-html-coding-system 'utf-8-unix | 1863 | org-html-coding-system 'utf-8-unix |
1864 | org-image-actual-width '(300) | 1864 | org-image-actual-width '(300) |
1865 | org-imenu-depth 3 | 1865 | org-imenu-depth 3 |
1866 | org-list-demote-modify-bullet '(("-" . "+") | 1866 | org-list-demote-modify-bullet '(("-" . "+") |
1867 | ("+" . "*") | 1867 | ("+" . "*") |
1868 | ("*" . "-")) | 1868 | ("*" . "-")) |
1869 | org-log-into-drawer t | 1869 | org-log-into-drawer t |
1870 | org-outline-path-complete-in-steps nil | 1870 | org-outline-path-complete-in-steps nil |
1871 | org-pretty-entities t | 1871 | org-pretty-entities t |
1872 | org-refile-use-outline-path 'file | 1872 | org-refile-use-outline-path 'file |
1873 | org-special-ctrl-a/e t | 1873 | org-special-ctrl-a/e t |
1874 | org-special-ctrl-k t | 1874 | org-special-ctrl-k t |
1875 | org-src-fontify-natively t | 1875 | org-src-fontify-natively t |
1876 | org-src-tab-acts-natively t | 1876 | org-src-tab-acts-natively t |
1877 | org-src-window-setup 'current-window | 1877 | org-src-window-setup 'current-window |
1878 | org-startup-truncated nil | 1878 | org-startup-truncated nil |
1879 | org-startup-with-inline-images t | 1879 | org-startup-with-inline-images t |
1880 | org-tags-column 0 ; (- 0 fill-column -3) | 1880 | org-tags-column 0) |
1881 | ) | ||
1882 | 1881 | ||
1883 | (:bind "RET" #'acdw-org/return-dwim | 1882 | (:bind "RET" #'acdw-org/return-dwim |
1884 | "<S-return>" #'acdw-org/org-table-copy-down | 1883 | "<S-return>" #'acdw-org/org-table-copy-down |
@@ -1916,6 +1915,43 @@ browser defined in `browse-url-secondary-browser-function'." | |||
1916 | (acdw-org/count-words-stupidly start | 1915 | (acdw-org/count-words-stupidly start |
1917 | end | 1916 | end |
1918 | 999))))) | 1917 | 999))))) |
1918 | |||
1919 | (with-eval-after-load 'org | ||
1920 | (org-clock-persistence-insinuate)) | ||
1921 | |||
1922 | (with-eval-after-load 'consult | ||
1923 | (defun consult-clock-in (&optional match scope resolve) | ||
1924 | "Clock into an Org heading." | ||
1925 | (interactive (list nil nil current-prefix-arg)) | ||
1926 | (require 'org-clock) | ||
1927 | (org-clock-load) | ||
1928 | (save-window-excursion | ||
1929 | (consult-org-heading | ||
1930 | match | ||
1931 | (or scope | ||
1932 | (thread-last org-clock-history | ||
1933 | (mapcar 'marker-buffer) | ||
1934 | (mapcar 'buffer-file-name) | ||
1935 | (delete-dups) | ||
1936 | (delq nil)) | ||
1937 | (user-error "No recent clocked tasks"))) | ||
1938 | (org-clock-in nil (when resolve | ||
1939 | (org-resolve-clocks) | ||
1940 | (org-read-date t t))))) | ||
1941 | |||
1942 | (consult-customize consult-clock-in | ||
1943 | :prompt "Clock in: " | ||
1944 | :preview-key (kbd "M-.") | ||
1945 | :group | ||
1946 | (lambda (cand transform) | ||
1947 | (if transform | ||
1948 | (substring | ||
1949 | cand | ||
1950 | (next-single-property-change 0 'consult-org--buffer cand)) | ||
1951 | (let ((m (car (get-text-property 0 'consult-org--heading cand)))) | ||
1952 | (if (member m org-clock-history) | ||
1953 | "*Recent*" | ||
1954 | (buffer-name (marker-buffer m)))))))) | ||
1919 | 1955 | ||
1920 | (:advise org-delete-backward-char :override #'acdw-org/delete-backward-char) | 1956 | (:advise org-delete-backward-char :override #'acdw-org/delete-backward-char) |
1921 | 1957 | ||