GNU bug report logs - #78053
[PATCH] Support strings for electric-pairs.

Previous Next

Package: emacs;

Reported by: Elijah Gabe Pérez <eg642616 <at> gmail.com>

Date: Fri, 25 Apr 2025 00:31:01 UTC

Severity: normal

Tags: patch

Full log


Message #23 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Rudolf Schlatte <rudi <at> constantly.at>
To: bug-gnu-emacs <at> gnu.org
Subject: Re: bug#78053: [PATCH] Support strings for electric-pairs.
Date: Sun, 25 May 2025 19:20:08 +0200
Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs <at> gnu.org> writes:

>>  (defun electric-pair--insert (char times)
>>    (let ((last-command-event char)
>> @@ -591,6 +604,11 @@ electric-pair-post-self-insert-function
>>                                pos))
>>           (forward-char num))
>>          ;; Insert matching pair.
>> +        ;; String pairs
>> +        ((and (eq syntax 'str) (not overwrite-mode))
>> +         (insert " ")
>> +         (save-excursion (insert " " pair)))
>> +        ;; Char pairs
>>          ((and (memq syntax '(?\( ?\" ?\$))
>>                (not overwrite-mode)
>>                (or unconditional
>
> I can imagine some multi-char delimiters which don't call for spaces
> inside of them (e.g. LaTeX's ``...''), so maybe the entries in
> `electric-pair-pairs` should have some extra info about it.
> I suggest we replace the (STRING . STRING) format with
> (STRING STRING ...) so we can put extra info in the `...`.

See for example Java's text blocks:

    The opening delimiter is a sequence of three double quote characters
    (""") followed by zero or more white spaces followed by a line
    terminator. The content begins at the first character after the line
    terminator of the opening delimiter.

    The closing delimiter is a sequence of three double quote
    characters. The content ends at the last character before the first
    double quote of the closing delimiter.

(https://openjdk.org/jeps/378) -- it would be nifty if the mandatory
linebreak was inserted automatically.





This bug report was last modified 1 day ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.