Emacs: Link of Word Etymology 🚀

By Xah Lee. Date: .

emacs, create link of word etymology

here's one of my helper command.

(defun xah-words-word-etymology-linkify ()
  "Make the current word into a etymology reference link.
Created: 2020-06-16
Version: 2021-05-02"
  (let (xp1 xp2 xword
            (xurl "https://www.etymonline.com/word/"))
    (if (region-active-p)
        (setq xp1 (region-beginning) xp2 (region-end))
      (setq xp1 (line-beginning-position) xp2 (line-end-position)))
    (setq xword (buffer-substring-no-properties xp1 xp2))
    (delete-region xp1 xp2)
    (insert (format "[etymology of %s <a href=\"%s%s\">%s%s</a>]" xword xurl xword xurl xword))))

i've been using the above command for maybe 5 or more years for my “Wordy English” blog.

since i work in html raw, i have lots of these. the way i work in html is similar to most using org mode.

so if you are a org mode user, you can also easily create a command that generate links to etymology of the word under cursor. and you can press a button to look it up. and also publish it. (e.g. if you blog about literature stuff a lot)