agumonkey · 2022-02-14 13:58
BettaGeorge · 2022-02-14 14:34
That is so weird.
agumonkey · 2022-02-14 17:00
found on https://news.ycombinator.com/item?id=30317088
licht1nstein · 2022-02-14 20:09
It's literally one line to make the same `comment` macro Clojure has. Super convenient.
arthurno1 · 2022-02-14 22:18
Interesting! :)
[Here is my first two minutes thought](https://postimg.cc/SnfNNfyh).
I just refactored your function somewhat :)
;;; test.el --- -*- lexical-binding: t; -*-
Don't know if it's useful in practice, but if we had multiline comments, we
could add invisible property on those markers to auto-hide them. Interlaced with
Emacs Lisp code, it gives a "feel" of literate programming.
(defun cursed-elisp-block-comment (beg end)
(interactive "r")
(save-excursion
(let ((start (format "#@%d " (+ (- end beg) 2))))
(goto-char end)
(insert "\037")
(put-text-property end (1+ end) 'invisible t)
(goto-char beg)
;; account for space and terminator
(insert start)
(put-text-property beg (+ beg (length start)) 'invisible t))))
(defun make-visible (beg end)
(interactive "r")
(remove-text-properties beg end '(invisible t)))
This file is a little demo of the concept, but to actually be useful, there
should probably be some routine that automatically marks text paragraphs with
invisible markers, since it is a bit labourous to do it by hand for each
paragraphs. Surprisingly, indentation engine didn't complain at all, while
font-lock of course does not know I am in a comment.
(message "hello multiline comments")
(provide 'test)
;;; test.el ends here
wasamasa · 2022-02-15 18:29
Took me a few goes to figure out what exactly you're doing. That's kind of cool.
arthurno1 · 2022-02-15 19:20
Thanks.
It was cool you found "multicomment" :-).