June 12th 2026 - Things I Worked On
Added pasting code blocks
Sometimes I copy code from somewhere and I want to paste it as an org-mode code block. This function pastes the code and wraps it with an org src block. It also goes into insert mode after pasting so you can type the language for syntax highlighting and formatting.
If the item you're pasting already has a code block prefix and suffix it pastes it as is.
(defun my/paste-code-block () "Paste the code in the kill ring into an org-mode code block." (interactive) (let ((code (current-kill 0))) (when code (if (and (s-prefix? "#+begin_src" code) (s-suffix? "#+end_src\n" code)) (insert code) (progn (insert "#+begin_src \n") (insert code) (insert "#+end_src\n") (if (re-search-backward "^#\\+begin_src" nil t) (progn (org-end-of-line) (evil-insert 1)) (message "Error: no src block found."))))))) (evil-leader/set-key "p c" 'my/paste-code-block)
Changed keybinding for zooming in, out, and resetting font size
Use a function key because it breaks my usage of -+_
(global-set-key (kbd "C-+") 'my/zoom-in) (global-set-key (kbd "C--") 'my/zoom-out) (global-set-key (kbd "C-=") 'my/zoom-reset)
Installed yasnippet
Install
(unless (package-installed-p 'yasnippet) (package-install 'yasnippet)) (require 'yasnippet)
Snippets
(setq yas-snippet-dirs '("~/.emacs.d/snippets")) (yas-global-mode 1)
Created snippet for installing packages
(unless (package-installed-p '$1) (package-install '$1)) (require '$1)$0
Added pasting link
Created a command for pasting links on thing at point or marked area.
(defun my/--paste-link-in-region (link) "Paste the LINK into the selected region" (if (use-region-p) (let* ((beg (region-beginning)) (end (region-end)) (text (buffer-substring-no-properties beg end))) (delete-region beg end) (insert (format "[[%s][%s]]" link text))))) (defun my/--paste-link-in-word (link) "Paste the LINK in the word at point" (let ((word (thing-at-point 'word t)) (word-bounds (bounds-of-thing-at-point 'word))) (when (and word-bounds link) (delete-region (car word-bounds) (cdr word-bounds)) (insert (format "[[%s][%s]]" link word))))) (defun my/paste-link-in-thing () "Paste the link in the kill ring into the selected region or word at point." (interactive) (let ((link (current-kill 0))) (when link (if (use-region-p) (my/--paste-link-in-region link) (my/--paste-link-in-word link)) (message "Pasted %s" link))))