This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-30
Channels
- # asami (4)
- # babashka (3)
- # beginners (21)
- # biff (22)
- # cljs-dev (6)
- # clojure (11)
- # clojure-europe (3)
- # clojure-norway (35)
- # clojure-spain (4)
- # clojurescript (14)
- # datalevin (2)
- # emacs (12)
- # exercism (2)
- # fulcro (10)
- # honeysql (4)
- # humbleui (3)
- # hyperfiddle (49)
- # instaparse (1)
- # introduce-yourself (1)
- # missionary (1)
- # off-topic (109)
- # pathom (2)
- # practicalli (21)
- # random (2)
- # rdf (2)
- # releases (2)
- # scittle (3)
- # specter (2)
Sharing a small emacs lisp function that I've come to use several times, latest today:
(defun teod/one-line-per-sentence ()
(interactive)
(let* ((s (delete-and-extract-region (mark) (point)))
(s2 (string-replace ". " ".\n" s)))
(insert s2)))
Alternative with thread-last
, which I learned from @elken today.
(defun teod/one-sentence-per-line ()
(interactive)
(thread-last (delete-and-extract-region (mark) (point))
(string-replace ". " ".\n")
(insert)))
evil-join
/ J
in normal-mode for me).
Derek Sivers argues for the same thing, if you prefer his opinion: https://sive.rs/1s
M-x teod/one-line-per-sentence
lets me move back. Perhaps I wrote something somewhere. Then I can mark the text, and run M-x teod/one-line-per-sentence
. And continue editing the paragraph as I like.
Edit: fix: I wrote N
(wrong) instead of J
(correct).(untested) Could probably also write it as
(thread-last
(delete-and-extract-region (mark) (point))
(string-replace ". " ".\n")
(insert))
Tested, works perfectly. Never new about thread-last
. Thanks for that too! Great to know coming from Clojure.
stylistically, do you prefer
;; 1
(thread-last (delete-and-extract-region (mark) (point))
(string-replace ". " ".\n")
(insert))
or
;; 2
(thread-last
(delete-and-extract-region (mark) (point))
(string-replace ". " ".\n")
(insert))
in Emacs Lisp?I always prefer flow (2) to hang (1) but I know it's a point of contention for some 😛 Pick whichever semantically fits
I like one line per sentence too @U3X7174KS, I got the idea from https://asciidoctor.org/docs/asciidoc-recommended-practices/#one-sentence-per-line.
Nice! Thanks for the reference. Interesting to hear that people were doing this in the 1930s! > We picked up this idea from the writing guide in the https://neo4j.com/docs/2.2.8/community-docs.html#_writing. However, it seems like the idea dates back a discovery by Buckminster Fuller in the 1930s, who called it https://vanemden.wordpress.com/2009/01/01/ventilated-prose/. The technique was also recommended in 2009 by Brandon Rhodes in a blog post about https://rhodesmill.org/brandon/2012/one-sentence-per-line/.