From xemacs-m  Wed Sep 24 01:24:04 1997
Received: from mercury.Sun.COM (mercury.Sun.COM [192.9.25.1])
	by xemacs.org (8.8.5/8.8.5) with SMTP id BAA26241
	for <xemacs-beta@xemacs.org>; Wed, 24 Sep 1997 01:24:03 -0500 (CDT)
Received: from Eng.Sun.COM ([129.146.1.25]) by mercury.Sun.COM (SMI-8.6/mail.byaddr) with SMTP id XAA24098; Tue, 23 Sep 1997 23:23:36 -0700
Received: from kindra.eng.sun.com by Eng.Sun.COM (SMI-8.6/SMI-5.3)
	id XAA26345; Tue, 23 Sep 1997 23:23:35 -0700
Received: from xemacs.eng.sun.com by kindra.eng.sun.com (SMI-8.6/SMI-SVR4)
	id XAA13574; Tue, 23 Sep 1997 23:23:33 -0700
Received: by xemacs.eng.sun.com (SMI-8.6/SMI-SVR4)
	id XAA09601; Tue, 23 Sep 1997 23:23:30 -0700
Date: Tue, 23 Sep 1997 23:23:30 -0700
Message-Id: <199709240623.XAA09601@xemacs.eng.sun.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
From: Martin Buchholz <mrb@Eng.Sun.COM>
To: Jens-Ulrik Holger Petersen <petersen@kurims.kyoto-u.ac.jp>
Cc: XEmacs Beta List <xemacs-beta@xemacs.org>
Subject: thing.elc (b23)
In-Reply-To: <lb4t7bz2ff.fsf@orion.kurims.kyoto-u.ac.jp>
References: <lb4t7bz2ff.fsf@orion.kurims.kyoto-u.ac.jp>
X-Mailer: VM 6.33 under 20.3 "Vienna" XEmacs  Lucid (beta14)
Reply-To: Martin Buchholz <mrb@Eng.Sun.COM>

>>>>> "Jens-Ulrik" == Jens-Ulrik Holger Petersen <petersen@kurims.kyoto-u.ac.jp> writes:

Jens-Ulrik> `thing-symbol' in "util/thing.elc" is giving me the following
Jens-Ulrik> backtrace, when I do

Jens-Ulrik> 	M-: (thing-symbol (point)) RET

This'll fix it.

--- lisp/utils/thing.el.old
+++ lisp/utils/thing.el
@@ -162,28 +162,30 @@
 
 (defun thing-symbol (here)
   "Return start and end of symbol at HERE."
-  (cond ((memq (char-syntax (char-after here)) '(?_ ?w))
-         (setq *last-thing* 'symbol)
-         (let ((end (scan-sexps here 1)))
-           (thing-region (min here (scan-sexps end -1)) end)))))
+  (when (and (< here (point-max))
+	     (memq (char-syntax (char-after here)) '(?_ ?w)))
+    (setq *last-thing* 'symbol)
+    (let ((end (scan-sexps here 1)))
+      (thing-region (min here (scan-sexps end -1)) end))))
 
 (defun thing-filename (here)
   "Return start and end of filename at HERE."
-  (cond ((memq (char-syntax (char-after here)) '(?w ?_ ?.))
-         (let (start end)
-	   (save-excursion
-	     (goto-char here)
-	     (and (re-search-forward "\\s \\|:\\s\"\\|$" nil t)
-		  (goto-char (setq end (match-beginning 0)))
-		  (or
-		   (and 
-		    (re-search-backward "[^_a-zA-Z0-9---#$.~/@]+" nil t)
-		    (setq start (+ (match-beginning 0)
-				   (if (bolp)
-				       0
-				     1))))
-		   (setq start (point-min)))
-		  (thing-region (min start here) (max here end))))))))
+  (when (and (< here (point-max))
+	     (memq (char-syntax (char-after here)) '(?w ?_ ?.)))
+    (let (start end)
+      (save-excursion
+	(goto-char here)
+	(and (re-search-forward "\\s \\|:\\s\"\\|$" nil t)
+	     (goto-char (setq end (match-beginning 0)))
+	     (or
+	      (and 
+	       (re-search-backward "[^_a-zA-Z0-9---#$.~/@]+" nil t)
+	       (setq start (+ (match-beginning 0)
+			      (if (bolp)
+				  0
+				1))))
+	      (setq start (point-min)))
+	     (thing-region (min start here) (max here end)))))))
 ;~/  
 (defun thing-sexp-start (here)
   "Return start and end of sexp starting HERE."

