bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#10754: define-minor-mode and doc of derived mode


From: John Shahid
Subject: bug#10754: define-minor-mode and doc of derived mode
Date: Fri, 29 Jun 2018 14:52:51 +0000
User-agent: mu4e 1.1.0; emacs 27.0.50

Stefan Monnier <address@hidden> writes:

>> Sounds reasonable, I was hesitant to make the implementation more
>> complicated but it turns out not to be that bad. Attached the patch to
>> either append the paragraph or insert it at the first empty line.
>
> Thanks, looks great to me.

Thanks for taking a look. fyi, the current implementation replace the
last "\n\n" instead of the first "\n\n". This is either a regression or
a bug in the documentation of `replace-regexp-in-string'. The patch is
doing the following expecting "doc" to appear between "foo" and "bar",
but instead it is inserted between "bar" and "baz"

    (replace-regexp-in-string "\\(\n\n\\).*\\'"
                              "\n\ndoc\\1"
                              "foo\n\nbar\n\nbaz"
                              nil
                              nil
                              1)


According to the doc ti should work:

    To replace only the first match (if any), make REGEXP match up to \'
    and replace a sub-expression, e.g.
      (replace-regexp-in-string "\\(foo\\).*\\'" "bar" " foo foo" nil nil 1)
        => " bar foo"

I'm happy to open a new bug for this, but I don't think it is a blocker
to merging this change.





reply via email to

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