-- Leo's gemini proxy

-- Connecting to idiomdrottning.org:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; lang=en

Zero-width spaces


I found that sometimes when I post long words I kind of want them to be able to break at slashes or hyphens in narrow windows. To do that, I can insert a unicode zero-width space after the slash.


For emacs, here’s a li’l Emacs thing you can set to whatever. Without a prefix, it inserts a slash and a zero-width space. With a prefix, it asks you for another character instead of the slash.


(defun zw-slash (pref)
  (interactive "P")
  (if pref (quoted-insert 1) (insert "/"))
  (insert-char ?\u200B))

There’s also something called a soft hyphen in case you have long words without any punctuation, like As­mo­ra­no­mar­di­ca­daisti­na­culda­car.


(defun soft-hyphenate-region (beginning end)
  "Turn hyphens into soft hyphens in region"
  (interactive "*r")
  (save-excursion
    (goto-char beginning)
    (while (search-forward "-" end t)
      (replace-match "­"))))

This one I’m not gonna bind because I don’t think I’ll use it often but it’s nice to have available in the M-x repertoire.

-- Response ended

-- Page fetched on Thu Mar 28 23:50:54 2024