[emacs-berlin] gnus "cut here" code snippets

jman emacs-berlin at city17.xyz
Sun Mar 26 10:44:52 UTC 2023


hey!

I was looking again at one of the last email from Michael in this
list[0], there is a special marker for code snippets that gnus
recognizes and applies a special coloring (a "face", I guess?).

So, the command is `message-mark-inserted-region` (C-c M-m), described
as "Mark some region in the current article with enclosing tags."

--8<---------------cut here---------------start------------->8---
whatever goes inside here will appear different, right?
--8<---------------cut here---------------end--------------->8---

I was curious, so I've tried hacking this long marker string
(`message-mark-insert-begin` and `message-mark-insert-end`), can it be
made shorter?

If I am not wrong this is defined by a regexp in mm-ul.el:

--8<---------------cut here---------------start------------->8---
(message-marks
     ;; Text enclosed with tags similar to `message-mark-insert-begin' and
     ;; `message-mark-insert-end'.  Don't use those variables to avoid
     ;; dependency on `message.el'.
     "^-+[8<>]*-\\{9,\\}[a-z ]+-\\{9,\\}[a-z ]+-\\{9,\\}[8<>]*-+$"
     "^-+[8<>]*-\\{9,\\}[a-z ]+-\\{9,\\}[a-z ]+-\\{9,\\}[8<>]*-+$"
     ,(lambda () (mm-uu-verbatim-marks-extract 0 0 1 -1))
     nil)
--8<---------------cut here---------------end--------------->8---

Which translated to English should be:
1. one "-" optionally followed by one "8" and one of "<" or ">"
2. nine times "-"
3. one alphabetic string (or space)
4. nine times "-"
5. one alphabetic string (or space)
6. nine times "-"
7. optionally one "8" and one of "<" or ">"
8. a closing "-"

and this leads me to think that these delimiters ...

----------s---------s----------
... can be reduced to this, but not any further, right?
----------e---------e----------

Wow, 47% of the original length! I'm sure this will save some trees when
sending emails around! :D

Anyway, it was fun digging into this completely useless thing and
customize my own shorter snippet message markers :)

happy hacking!

[0]: https://mailb.org/pipermail/emacs-berlin/2023/000997.html


More information about the emacs-berlin mailing list