labnotes

Updating date in org file

simple and fun

tags
emacs
org-mode

Contents

More on the learning to emacs.

  1. Save the cursor position to orig-point
  2. Go to the beginning of the file
  3. Look for #+date
  4. If you find it, move to the beginning of the line and delete it
  5. Otherwise move down one line
  6. Insert the new date
  7. Go back to where you started
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
  (defun blog-mode-update-date ()
    (interactive)
    (let ((orig-point (point)))
      (goto-char (point-min))
      (if (search-forward "#+date" nil t)
          (progn
            (move-beginning-of-line 1)
            (kill-line))
        (progn
          (next-line)))
      (insert "#+date: " (format-time-string "%Y-%m-%dT%H:%M:%S"))
      (goto-char orig-point)))

Previously

fragments

bad analogies

tags
language
mastodon

Next

labnotes

Playing with unocss

Slimmer than tailwind, but still cool

tags
unocss
tailwind