mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-23 21:37:34 +00:00
Make elide-head-headers-to-hide more forgiving
* lisp/elide-head.el (elide-head-headers-to-hide): Make regexp more forgiving of line breaks and comment characters in address. * test/lisp/elide-head-tests.el (gpl3-6): New test.
This commit is contained in:
parent
2ffe1494e1
commit
fb0ff54eb4
2 changed files with 115 additions and 18 deletions
|
|
@ -50,24 +50,37 @@
|
|||
:group 'tools)
|
||||
|
||||
(defcustom elide-head-headers-to-hide
|
||||
`(;; GNU GPL
|
||||
("is free software[:;] you can redistribute it" .
|
||||
,(rx (or (seq "If not, see " (? "<")
|
||||
"http" (? "s") "://www.gnu.org/licenses"
|
||||
(? "/") (? ">") (? " "))
|
||||
(seq "Boston, MA " (? " ")
|
||||
"0211" (or "1-1307" "0-1301")
|
||||
(or " " ", ") "USA")
|
||||
"675 Mass Ave, Cambridge, MA 02139, USA")
|
||||
(? ".")))
|
||||
;; FreeBSD license / Modified BSD license (3-clause)
|
||||
(,(rx (or "The Regents of the University of California. All rights reserved."
|
||||
"Redistribution and use in source and binary"))
|
||||
. "POSSIBILITY OF SUCH DAMAGE\\.")
|
||||
;; X11 and Expat
|
||||
("Permission is hereby granted, free of charge" .
|
||||
,(rx (or "authorization from the X Consortium." ; X11
|
||||
"THE USE OR OTHER DEALINGS IN THE SOFTWARE.")))) ; Expat
|
||||
(rx-let ((delim
|
||||
;; A line break could be in a non-standard place, and the
|
||||
;; license could be in a comment.
|
||||
(or
|
||||
;; Either just some spaces:
|
||||
(+ " ")
|
||||
;; Or a newline and some comment starter:
|
||||
(: (* (in " \t"))
|
||||
"\n"
|
||||
(* (in " \t"))
|
||||
(* (or (syntax comment-start) (in ";#*-")))
|
||||
(* (in " \t"))))))
|
||||
`(;; GNU GPL
|
||||
("is free software[:;] you can redistribute it" .
|
||||
,(rx (or (seq "If not, see " (? "<")
|
||||
"http" (? "s") "://www.gnu.org/licenses"
|
||||
(? "/") (? ">") (? " "))
|
||||
(seq "Boston," delim "MA" delim
|
||||
(or "02111-1307" "02110-1301" "02111-1301")
|
||||
(? ",") delim
|
||||
"USA")
|
||||
"675 Mass Ave, Cambridge, MA 02139, USA")
|
||||
(? ".")))
|
||||
;; FreeBSD license / Modified BSD license (3-clause)
|
||||
(,(rx (or "The Regents of the University of California. All rights reserved."
|
||||
"Redistribution and use in source and binary"))
|
||||
. "POSSIBILITY OF SUCH DAMAGE\\.")
|
||||
;; X11 and Expat
|
||||
("Permission is hereby granted, free of charge" .
|
||||
,(rx (or "authorization from the X Consortium." ; X11
|
||||
"THE USE OR OTHER DEALINGS IN THE SOFTWARE."))))) ; Expat
|
||||
"Alist of regexps defining start and end of text to elide.
|
||||
|
||||
The cars of elements of the list are searched for in order. Text is
|
||||
|
|
|
|||
|
|
@ -180,6 +180,90 @@
|
|||
;; along with Mentor. If not, see <https://www.gnu.org/licenses>.
|
||||
" "Mentor is distributed in the hope that")
|
||||
|
||||
;; from GnuTLS [has a line break in snail mail address]
|
||||
(elide-head--add-test gpl3-6 "\
|
||||
# This file is part of GnuTLS.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
|
||||
# USA
|
||||
" "This program is distributed in the hope that")
|
||||
|
||||
;; from GnuTLS [has a different line break in snail mail address]
|
||||
(elide-head--add-test gpl3-7 "\
|
||||
# This file is part of GnuTLS.
|
||||
#
|
||||
# The GnuTLS is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation; either version 2.1 of
|
||||
# the License, or (at your option) any later version.
|
||||
#
|
||||
# The GnuTLS is distributed in the hope that it will be
|
||||
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
||||
# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# Lesser General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with GnuTLS; if not, write to the Free
|
||||
# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
# MA 02110-1301, USA
|
||||
" "The GnuTLS is distributed in the hope that")
|
||||
|
||||
;; from GnuTLS [has a typo in the 02111-1301 part]
|
||||
(elide-head--add-test gpl3-8 "\
|
||||
/* nettle, low-level cryptographics library
|
||||
*
|
||||
* Copyright (C) 2002 Niels Möller
|
||||
* Copyright (C) 2014 Red Hat
|
||||
*\s\s
|
||||
* The nettle library is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or (at your
|
||||
* option) any later version.
|
||||
*\s
|
||||
* The nettle library is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
* License for more details.
|
||||
*\s
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with the nettle library; see the file COPYING.LIB. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02111-1301, USA.
|
||||
*/
|
||||
" "The nettle library is distributed in the hope that")
|
||||
|
||||
;; from GnuTLS-EXTRA [has a different line break in snail mail address]
|
||||
(elide-head--add-test gpl3-9 "\
|
||||
# This file is part of GnuTLS-EXTRA.
|
||||
#
|
||||
# GnuTLS-extra is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License as
|
||||
# published by the Free Software Foundation; either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# GnuTLS-extra is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with GnuTLS-EXTRA; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
" "GnuTLS-extra is distributed in the hope that")
|
||||
|
||||
|
||||
;;; GPLv2
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue