Lawrence Mitchell writes: > Bastien Guerry wrote: > > > [...] > > >>> (defun ielm-trim-comments (string) >>> "Trim comments in STRING." >>> (let ((pos (previous-single-property-change >>> (length string) 'face string))) >>> (if (eq (get-text-property pos 'face) >>> 'font-lock-comment-face) >>> (substring string 0 pos)))) > > This breaks if the user doesn't use font-lock. Right. I have come up with another solution, not relying on font-lock, but this one doesn't allow the double-quote character in comments. Please improve it if you can. If no objection/suggestion until next week, I'll apply this one.