From: Tino Calancha Date: Tue, 11 Oct 2016 02:47:32 +0000 (+0900) Subject: form-at-point work for all kind of THINGS X-Git-Tag: emacs-26.0.90~1486 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9640e9f4e95cd95c04875e90a4ff638e1e51f977;p=emacs.git 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). --- 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