Subject: 24.0.97; [PATCH] forward-same-syntax: wrong-type-argument number-or-marker-p nil

From: "Aaron S. Hawley" <[email-masked]>
Date: Fri, 25 May 2012 15:40:13 -0400

[I'm using a pretest, but this isn't a regression.  Applying the fix
in 24.2 is fine with me.]

Reproduce:

M-x load-library thingatpt
M-: (forward-same-syntax)

gives Lisp error: (wrong-type-argument number-or-marker-p nil)

Thanks for Emacs,
/a

2012-05-25  Aaron S. Hawley  <[email-masked]>

        * thingatpt.el (forward-same-syntax): Calling as a function in
        Lisp with no argument gives error "wrong-type-argument
        number-or-marker-p nil" from `while'.

--- thingatpt.el	2012-04-07 23:03:02.000000000 -0400
+++ thingatpt.el	2012-05-25 12:33:28.817991100 -0400
@@ -455,8 +455,9 @@
 (defun forward-same-syntax (&optional arg)
  "Move point past all characters with the same syntax class.
 With prefix argument ARG, do it ARG times if positive, or move
 backwards ARG times if negative."
   (interactive "p")
+  (or arg (setq arg 1))
   (while (< arg 0)
     (skip-syntax-backward
      (char-to-string (char-syntax (char-before))))