# HG changeset patch # User Mats Lidell # Date 1355444376 -3600 # Node ID 9dc294ae3004d8bf4a793daeef11f559601ccb43 # Parent 7f4c8574a590f3e3457bdecf5716aa21a64626c8 Fix erroneous regular xpression in register.el. Thank you Stephen Turnbull. lisp/ChangeLog additions: 2012-12-14 Mats Lidell * register.el (describe-register-1): Fix erroneous regular expression. Thank you Stephen Turnbull. tests/ChangeLog additions: 2012-12-14 Mats Lidell * automated/register-tests.el: New. Test for register.el. Test case for bug in regular expression in describe-register-1 diff -r 7f4c8574a590 -r 9dc294ae3004 lisp/ChangeLog --- a/lisp/ChangeLog Tue Nov 06 23:12:06 2012 +0000 +++ b/lisp/ChangeLog Fri Dec 14 01:19:36 2012 +0100 @@ -1,3 +1,8 @@ +2012-12-14 Mats Lidell + + * register.el (describe-register-1): Fix erroneous regular + expression. Thank you Stephen Turnbull. + 2012-11-06 Aidan Kehoe * cl-macs.el (equal, member, assoc, rassoc): diff -r 7f4c8574a590 -r 9dc294ae3004 lisp/register.el --- a/lisp/register.el Tue Nov 06 23:12:06 2012 +0000 +++ b/lisp/register.el Fri Dec 14 01:19:36 2012 +0100 @@ -1,6 +1,6 @@ ;;; register.el --- register commands for Emacs -;; Copyright (C) 1985, 1993, 1994, 1997 Free Software Foundation, Inc. +;; Copyright (C) 1985, 1993, 1994, 1997, 2012 Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: internal, dumped @@ -237,7 +237,7 @@ (princ val)) (cond ;; Extract first N characters starting with first non-whitespace. - ((string-match (format "[^ \t\n].\\{,%d\\}" + ((string-match (format "[^ \t\n].\\{0,%d\\}" ;; Deduct 6 for the spaces inserted below. (min 20 (max 0 (- (window-width) 6)))) val) diff -r 7f4c8574a590 -r 9dc294ae3004 tests/ChangeLog --- a/tests/ChangeLog Tue Nov 06 23:12:06 2012 +0000 +++ b/tests/ChangeLog Fri Dec 14 01:19:36 2012 +0100 @@ -1,3 +1,8 @@ +2012-12-14 Mats Lidell + + * automated/register-tests.el: New. Test for register.el. Test + case for bug in regular expression in describe-register-1 + 2012-10-13 Mats Lidell * automated/process-tests.el: Simple test cases for diff -r 7f4c8574a590 -r 9dc294ae3004 tests/automated/register-tests.el --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/automated/register-tests.el Fri Dec 14 01:19:36 2012 +0100 @@ -0,0 +1,48 @@ +;; Copyright (C) 2012 Free Software Foundation, Inc. + +;; Author: Mats Lidell +;; Maintainer: +;; Created: 2012 +;; Keywords: tests + +;; This file is part of XEmacs. + +;; XEmacs 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. + +;; XEmacs 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 XEmacs. If not, see . + +;;; Synched up with: Not in FSF. + +;;; Commentary: + +;; Test tag support. +;; See test-harness.el for instructions on how to run these tests. + +(require 'test-harness) + +(let ((s "Short")) + (with-output-to-temp-buffer "*Output Register Tests*" + (set-register 'a s) + (Assert (equal (get-register 'a) s)) + (Assert (equal (describe-register-1 'a t) s)) + (Assert (equal (describe-register-1 'a) s)))) + +;; describe-register-1 without verbose on depends on window-width +;; which is 10!? in batch mode. Hence the short part of the string +;; returned + +(let ((s "String longer than 5 chars")) + (with-output-to-temp-buffer "*Output Register Tests*" + (set-register 'a s) + (Assert (equal (get-register 'a) s)) + (Assert (equal (describe-register-1 'a t) s)) + (Assert (equal (describe-register-1 'a) (subseq s 0 5)))))