[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Recognizing quotations in message-mode
From: |
Emanuel Berg |
Subject: |
Re: Recognizing quotations in message-mode |
Date: |
Fri, 11 Dec 2015 00:44:47 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
Marcin Borkowski <mbork@mbork.pl> writes:
> Is there a function which, called in message-mode,
> would tell me whether the point is within
> a quotation?
Because comments in `message-mode' are inserted and
interacted with the same way comments in programming
modes, I thought the downmost code would work. But it
doesn't; perhaps the "syntax" of a message hasn't been
added to, or is incompatible with, the workings of
`syntax-ppss'.
Anyway, what about this?
(defun point-in-quotation-p ()
(save-excursion
(beginning-of-line)
(string= ">" (thing-at-point 'char t))))
You can use `comment-start' if you don't want to
hard-code the ">".
Here is the code that didn't work - perhaps some of it
can be brought over to the above code tho, in
particular the interactive stuff.
(defun point-in-comment-p (&optional print-message)
(interactive "p")
"True iff point is in a comment."
(let*((comment (nth 8 (syntax-ppss)))
(feedback (format "%s comment" (if comment "Yes:" "No"))) )
(prog1 comment
(when print-message (message feedback)) )))
--
underground experts united
http://user.it.uu.se/~embe8573