From 2c4665ee2a4e94e2a51e868ac60667118a2df6d3 Mon Sep 17 00:00:00 2001 From: Mez Date: Mon, 25 Aug 2025 20:35:52 +0100 Subject: [PATCH] Use more completing-read in capture functions --- config.org | 19 +++++++++++++------ custom/capture.el | 28 +++++++++++++++++++++++----- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/config.org b/config.org index d9a5e92..9e5f859 100644 --- a/config.org +++ b/config.org @@ -49,14 +49,21 @@ I don’t want finding files to be case-sensitive, same as in =zsh=: (setq read-buffer-completion-ignore-case t) #+END_SRC -Remove certain graphical elements. +Allow typing spaces in the minibuffer. #+BEGIN_SRC emacs-lisp - (setq inhibit-startup-screen t) - (tool-bar-mode -1) - (unless (string-equal system-type "android") - (scroll-bar-mode -1)) - (tooltip-mode -1) + (define-key minibuffer-local-completion-map " " 'self-insert-command) + (define-key minibuffer-local-must-match-map " " 'self-insert-command) +#+END_SRC + + Remove certain graphical elements. + + #+BEGIN_SRC emacs-lisp + (setq inhibit-startup-screen t) + (tool-bar-mode -1) + (unless (string-equal system-type "android") + (scroll-bar-mode -1)) + (tooltip-mode -1) #+END_SRC Make everything just a little tiny bit transparent unless I’m using the boring Windows desktop. diff --git a/custom/capture.el b/custom/capture.el index 797fb38..8ea4daf 100644 --- a/custom/capture.el +++ b/custom/capture.el @@ -224,6 +224,24 @@ (setq returnprogress (concat "*" bookprogress "%.* ")) returnprogress) + (defun setgame () + "Suggest game titles from a list" + (setq games (s-split "\n" (f-read "~/Documents/proj/trackers/gamescomplete") t)) + (setq thegame (completing-read "Title: " games)) + thegame) + + (defun setauthor () + "Suggest authors from a list" + (setq authors (s-split "\n" (f-read "~/Documents/proj/trackers/authorscomplete") t)) + (setq theauthor (completing-read "Author: " authors)) + theauthor) + + (defun setbook () + "Suggest book titles from a list" + (setq books (s-split "\n" (f-read "~/Documents/proj/trackers/bookscomplete") t)) + (setq thebook (completing-read "Title: " books)) + thebook) + (defun timenow () "Print the current time" (format-time-string "%H:%M:%S")) @@ -235,7 +253,7 @@ :jump-to-captured t) ("b" "Finished book" entry (file+function "" findread) - "* %^{Author} /%^{Title}/%(therating)%(theworkbook)" + "* %(setauthor) /%(setbook)/%(theworkbook)" :jump-to-captured t) ("f" "Watched film" entry (file+function "" findwatched) @@ -243,7 +261,7 @@ :jump-to-captured t) ("g" "Beat game" entry (file+function "" findbeaten) - "* %^{Title} (%(setconsole))" + "* %(setgame) (%(setconsole))" :jump-to-captured t) ("m" "Musical performance" entry (file+function "" findperf) @@ -251,7 +269,7 @@ :jump-to-captured t) ("n" "Gameplay progress" entry (file+function "" findgaming) - "* %^{Title} (%(setconsole))\n%?" + "* %(setgame) (%(setconsole))\n%?" :jump-to-captured t) ("o" "Obtained game" entry (file+function "" findobtained) @@ -263,7 +281,7 @@ :jump-to-captured t) ("r" "Reading progress" entry (file+function "" findreading) - "* %^{Author} /%^{Title}/%(theworkbook)\n%(bookcalc)%?" + "* %(setauthor) /%(setbook)/%(theworkbook)\n%(bookcalc)%?" :jump-to-captured t) ("u" "Website update" entry (file+function "" findweb) @@ -275,7 +293,7 @@ :jump-to-captured t) ("1" "Completed game" entry (file+function "" findhundred) - "* %^{Title} (%(setconsole))" + "* %(setgame) (%(setconsole))" :jump-to-captured t))) (defun org-capture-today ()