š¾ Archived View for idiomdrottning.org āŗ zw-slash captured on 2023-09-08 at 17:00:19. Gemini links have been rewritten to link to archived content
ā¬ ļø Previous capture (2021-12-03)
-=-=-=-=-=-=-
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.