diff options
author | Tino Calancha <tino.calancha@gmail.com> | 2016-10-11 11:47:32 +0900 |
---|---|---|
committer | Tino Calancha <tino.calancha@gmail.com> | 2016-10-11 11:47:32 +0900 |
commit | 9640e9f4e95cd95c04875e90a4ff638e1e51f977 (patch) | |
tree | c959dde4493e06543795cf8edc5744aa707ab844 /lisp/thingatpt.el | |
parent | db677f5dfedc0a665211d1113251e77a01e5d5e3 (diff) | |
download | emacs-9640e9f4e95cd95c04875e90a4ff638e1e51f977.tar.gz emacs-9640e9f4e95cd95c04875e90a4ff638e1e51f977.tar.bz2 emacs-9640e9f4e95cd95c04875e90a4ff638e1e51f977.zip |
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).
Diffstat (limited to 'lisp/thingatpt.el')
-rw-r--r-- | lisp/thingatpt.el | 8 |
1 files 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 |