Complex Capture Template: rx '**' range error?
Hello, friends!
So I have a complex way of capturing TODO tasks for today or week. Someone will probably tell me that there's a package out there somewhere to do this easier, but regardless I would like to figure this out.
Here's the function I use:
(defun org-capture::today-task-tree ()
"Create a task tree for tasks TODO today."
(let* ((time-string (format-time-string "<%Y-%m-%d %a>" (current-time)))
(heading (concat "[%] " time-string))
(heading-rx
(rx (group "[" (0+ num) "%]") (0+ space)
(group (literal time-string)))))
(goto-char (point-max))
(if-let (pnt (re-search-backward
heading-rx
nil t))
(goto-char pnt)
(goto-char (point-max))
(or (bolp) (insert "\n"))
(insert "* " heading "\n")
(beginning-of-line 0))
(org-end-of-subtree)))
And here's the org-capture-templates
entry:
("gt" "Today: A task for today" entry
(file+function
,(expand-file-name "~/Documents/Org/GTD/work.org")
org-capture::today-task-tree)
(file ,(concat my-emacs-dir "capture-templates/datetree-weekly-tasks.tmplt"))
:empty-lines-after 1
:after-finalize (lambda () (org-update-statistics-cookies t)))
And here's the actual capture template that I store in a file in my config:
** [ ] [#%^{Priority}] %^{Task name} %(funcall-interactively #'org-deadline nil (current-time)) %^g
%? %i
Now when I'm in that file ~/Documents/Org/GTD/work.org
and I run the above function with M-: org-capture::today-task-tree
it works fine. An example of what the file will look like it:
* [100%] 2024-04-27 Mon
** [X] Do something important this Monday #[A] :work:
CLOSED: 2024-04-27 Mon 12:42 DEADLINE: 2024-04-27 Mon
* [%] 2024-04-28 Tues
** [ ] Do something else that's not as important #[B] :personal:
DEADLINE: 2024-04-27
But for whatever reason when I run org-capture
and finish the capture with C-c C-c
or refile with C-c C-w
I get
rx--translate-bounded-repetition: rx ‘**’ range error
Which I don't really know what that means nor how to fix it, and I can't really find anything useful via searching the internet at the moment. A possible thing to not is that I disable Org's element caching.
If you want to look at my configuration to dig around some, you can find it here and the part where my configurations for Org-Mode are here.
Show/highlight invisible characters like zero-width-space in Emacs
In my pursuit to migrate from Vim to Emacs, I have stumbled on yet another roadblock.
When working with files that contain special whitespace characters, Vim/Neovim would automatically highlight these. This saved me a lot of time during debugging or data analysis, and is a functionality that I struggled to get to work on more modern IDEs.
However, this does not work out-of-the-box neither on vanilla Emacs nor Doom Emacs. I am unable to find any working solutions online. I assumed whitespace-mode
would have handled this, but it is not the case.
It would be really helpful if the community here can help solve my problem as I deal with such characters on a daily basis. Until then, I have to pause my pursuit and stick with the trusty Neovim.
::: spoiler U+200B in Neovim
Notice Neovim highlighting the character as <200B>
.
:::
::: spoiler U+200B in Doom Emacs
Notice the think cursor between "hello" and "world".
:::
Thanks to the suggestion by @nmtake@lemm.ee, glyphless-display-mode
allows me to view the characters. But it still doesn't play well with vim motions on Emacs.
Here is a demonstration, and below are the keystrokes.
C-v
to enableVISUAL-BLOCK
mode.9j
to select all 9 occurrences.d
to delete the selection.
The above vim-motion works on Neovim but not on Emacs with evil-mode.
If anyone wants to try out here is the text I am playing with:
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
I've been using konsole (and iterm2 on my work mac) for most of my working career, but on the linux side, I've recently switched to Kitty, but now I'm wondering if I can finally get used to just using emacs on both.
Does anyone use emacs as their main terminal? Is there one better than ansi-term that supports modern features like libsixel?
I still can't quite get used to the keybindings (like C-c twice for ^C) and some other weirdness.
Emacs: modern minibuffer packages (Vertico, Consult, etc.)
https://protesilaos.com/codelog/2024-02-17-emacs-modern-minibuffer-packages/
Video demonstration of modern packages that improve the Emacs minibuffer.
The Emacs Window Management Almanac
https://karthinks.com/software/emacs-window-management-almanac/
Window management in Emacs gets a bad rap. Some of this is deserved, but mostly this is a consequence of combining a very flexible and granular layout system with rather coarse controls. This leaves the door open to creating and using tools for handling windows that employ and provide better metaphors and affordances. As someone who’s spent an unnecessary amount of time trying different approaches to window management in Emacs over the decades, I decided to summarize them here.
Writing Lisp Code with ChatGPT | Plain DrOps
https://plaindrops.de/blog/2024/CodingLispWithChatGPT/
That was easy!
Projekt Medusa: Denote | Plain DrOps
https://plaindrops.de/blog/2024/medusadenote/
Off with the head
[QUESTION] Book recommendation for Emacs
Hello!
Since I spend most of my day on the bus, I have a lot of time to read. Do you have any book recommendations for learning Emacs? I plan to use Emacs as a text editor for note taking and programming in general.
[Humor] A song about the Emacs Philosophy
Emacs Philosophy « Blog « extrema.is
https://www.extrema.is/blog/2024/04/29/emacs-philosophy
"Emacs Philosophy" is an Emacs-themed song that I created for a friend. I wrote the lyrics myself and created the audio using Suno and Udio.