From 9640e9f4e95cd95c04875e90a4ff638e1e51f977 Mon Sep 17 00:00:00 2001 From: Tino Calancha Date: Tue, 11 Oct 2016 11:47:32 +0900 Subject: [PATCH] form-at-point work for all kind of THINGS * lisp/thingatpt.el (form-at-point): Use thing-at-point--read-from-whole-string only if thing-at-point returns a string (Bug#24605). --- lisp/thingatpt.el | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el index df5c52d4d61..6d1014bb92d 100644 --- a/lisp/thingatpt.el +++ b/lisp/thingatpt.el @@ -586,9 +586,11 @@ Signal an error if the entire string was not used." "This is an internal thingatpt function and should not be used.") (defun form-at-point (&optional thing pred) - (let ((sexp (ignore-errors - (thing-at-point--read-from-whole-string - (thing-at-point (or thing 'sexp)))))) + (let* ((obj (thing-at-point (or thing 'sexp))) + (sexp (if (stringp obj) + (ignore-errors + (thing-at-point--read-from-whole-string obj)) + obj))) (if (or (not pred) (funcall pred sexp)) sexp))) ;;;###autoload -- 2.11.4.GIT