[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: electric-pair-mode as a minor mode?

From: João Távora
Subject: Re: electric-pair-mode as a minor mode?
Date: Mon, 30 Mar 2015 16:43:43 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt)

Stefan Monnier <address@hidden> writes:

> 14 is definitely not right.  A "comment fence" means "this char starts
> or ends a comment, depending on whether we're inside a comment".

oh, silly.

> That's because you mis-used the comment markers.  They should only be
> put at the beginning and at the end of the comment.

Makes sense. Look better?

(defvar message--comment-regexps
  ;; TODO: make this user-visible/customizable???
        ;; smiley regexp (TODO find a better one)
        ;; citations
        (concat "^" message-cite-prefix-regexp ".*$") ; citations
        ;; TODO: probably should be one here for citation header lines
        ;; TODO: also, let user add some of his own here?
  "List of regexps counting as comments in message-mode buffers.")

(defun message--syntax-propertize (beg end)
  "Syntax-propertize certain message parts as comments."
  (mapc (lambda (regexp)
          (goto-char beg)
          (while (search-forward-regexp regexp end 'noerror)
            (let ((start (match-beginning 0))
                  (end (match-end 0)))
              (add-text-properties start (1+ start)
                                   '(syntax-table (11 . nil)))
              (add-text-properties (1- end) end
                                   '(syntax-table (12 . nil))))))

>> * I'm using `message-cite-prefix-regexp' to detect citations. It's what
>>   font-lock in lisp/gnus/message.el uses so it seems ideal. But there
>>   are also a lot of vars like `message-yank-prefix', whose docstring
>>   contains the following line which baffles me:
>>> Fix `message-cite-prefix-regexp' if it is set to an abnormal value.
> Hopefully Lars can say something useful about that.

I'll follow up with a proper patch then.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]