Skeleton: a quick text transformers

I use to wrap a selection region with a symbol. For example: wr-love-equation 1 2 3 4 5 (defun wr-love-equation (start end) (interactive "r") (save-excursion (goto-char end) (insert "$") (goto-char start) (insert "$"))) I use it a lot, but as you can see, it is not very flexible. See, you select a region: Goggins. Then, you call M-x hello-world-skeleton: 1 2 3 4 (define-skeleton hello-world-skeleton "Define a motherfucker" nil "The world hardest motherfucker: " _ "!

Ivy add helper function for quick copy function name

The name of a function is often used for reference when writing this blog. M-x a-function-name then M-o, we can see there is a selection panel: o: default i: open the file according to the environment d: definition h: help With the function wr/ivy-yank-function-name-action, you can copy the function name using the correct format. 1 2 3 4 5 6 7 8 9 10 11 12 13 (defun wr/ivy-yank-function-name-action (x) "Send name of function to kill-ring.

Use Org-transclusion for linking the note

Introduction Linking notes can be helpful for a variety of reasons. One reason to link notes is to establish connections between different pieces of information. This can help you see the relationships between different ideas and concepts, which can be useful for learning and understanding. Linking notes can also help you organize your thoughts and ideas, making it easier to find and reference specific notes later. Additionally, linking notes can help you build a more comprehensive and coherent understanding of a subject, as it allows you to see how different ideas fit together.

Citation in this blog

If you want to cite a reference like this , you need to do some extra configuration. The manual is clearly written. The user can eval the following code to automatically generate a reference list. 1 2 3 4 5 6 7 8 9 10 11 (with-eval-after-load 'ox (defun my/org-ref-process-buffer--html (backend) "Preprocess `org-ref' citations to HTML format. Do this only if the export backend is `html' or a derivative of that.

Combine link-hint-open-link and org-ref-jump-to-visible-key

org-ref-jump-to-visible-key can identify multiple candidates, but it does not contain a regular link in Org-mode. link-hint-open-link on the other hand, can identify a normal link but is not very good at finding multiple citation keys. We need a strong merge. Following code snippet can merge two types of link, but I don’t feel this is the best way to achieve this. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 (defun wr/pos-getter (arg) (plist-get arg :pos)) (defun wr/org-ref-jump-to-visible-key () "Jump to a visible key with avy.

My principle of refile

Similar to many Org-mode users’ preferences, I also use inbox.org a lot. But I never really take full potential on using it. I think it is an important component for anyone who wants to work more efficiently and creatively at the same time. I have done a pretty good job in capture them. Just by peeking the inbox.org at current time state (83 unprocessed headings), however, I don’t think that I have done it in a good manner.

Switch to yesterday or tomorrow based on current daily buffer

If you are in a buffer: 2022-12-28.org, how you’re going to switch to day 2022-12-27.org or to day 2022-12-29.org? I used org-roam-dailies-goto-date to do such a switch, but the default selection is based on the current date, not the buffer the user is currently visiting. The following snippet can help you to navigate through yesterday’s or tomorrow based on the current daily note. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 (defun wr/org-roam-dailies-capture-current-daily-date-yesterday (&optional goto keys) "" (interactive "P") (if (org-roam-dailies--daily-note-p) (let* ((ts-default-format "%Y-%m-%d") (current-date-for-this-buffer (buffer-file-name)) (yesterday-date (ts-format (ts-adjust 'day -1 (ts-parse (file-name-sans-extension (file-name-nondirectory current-date-for-this-buffer))))))) (org-roam-dailies--capture (time-convert (ts-unix (ts-parse yesterday-date))) t keys)) (message "Not in a daily buffer"))) (defun wr/org-roam-dailies-capture-current-daily-date-tomorrow (&optional goto keys) "" (interactive "P") (if (org-roam-dailies--daily-note-p) (let* ((ts-default-format "%Y-%m-%d") (current-date-for-this-buffer (buffer-file-name)) (tomorrow-date (ts-format (ts-adjust 'day +1 (ts-parse (file-name-sans-extension (file-name-nondirectory current-date-for-this-buffer))))))) (org-roam-dailies--capture (time-convert (ts-unix (ts-parse tomorrow-date))) t keys)) (message "Not in a daily buffer")))