GNU bug report logs - #10754
define-minor-mode and doc of derived mode

Previous Next

Package: emacs;

Reported by: Glenn Morris <rgm <at> gnu.org>

Date: Tue, 7 Feb 2012 18:04:02 UTC

Severity: wishlist

Found in version 24.0.93

Fixed in version 27.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: John Shahid <jvshahid <at> gmail.com>
To: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
Cc: Eli Zaretskii <eliz <at> gnu.org>, drew.adams <at> oracle.com, 10754 <at> debbugs.gnu.org
Subject: bug#10754: define-minor-mode and doc of derived mode
Date: Fri, 29 Jun 2018 14:52:51 +0000
Stefan Monnier <monnier <at> IRO.UMontreal.CA> 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.




This bug report was last modified 6 years and 194 days ago.

Previous Next


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