2

I utilize the text register to collect new words I encountered

C-x r s w (w for word)

append others to it with M-x append-to-register

Record all the word collected to a works.org file at the end of the day.

Unfortunately, If the machine crashed during the day, all the records in register are gone.

How could save the records in text register persistently?

2

I wouldn't use registers for that, you could just write to words.org during the day. Something like this will do that either for the region you have highlighted, or the word at point, and you could bind it to a key if you want.

(require 'thingatpt)

(defun my-append-word ()
  (interactive)
  (let ((word (if (not (region-active-p))
          (word-at-point)
        (buffer-substring (region-beginning) (region-end)))))
    (with-current-buffer (find-file-noselect "words.org")
      (goto-char (point-max))
      (insert word "\n")
      (save-buffer))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.