aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTino Calancha2016-10-11 11:47:32 +0900
committerTino Calancha2016-10-11 11:47:32 +0900
commit9640e9f4e95cd95c04875e90a4ff638e1e51f977 (patch)
treec959dde4493e06543795cf8edc5744aa707ab844
parentdb677f5dfedc0a665211d1113251e77a01e5d5e3 (diff)
downloademacs-9640e9f4e95cd95c04875e90a4ff638e1e51f977.tar.gz
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).
-rw-r--r--lisp/thingatpt.el8
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."
586 "This is an internal thingatpt function and should not be used.") 586 "This is an internal thingatpt function and should not be used.")
587 587
588(defun form-at-point (&optional thing pred) 588(defun form-at-point (&optional thing pred)
589 (let ((sexp (ignore-errors 589 (let* ((obj (thing-at-point (or thing 'sexp)))
590 (thing-at-point--read-from-whole-string 590 (sexp (if (stringp obj)
591 (thing-at-point (or thing 'sexp)))))) 591 (ignore-errors
592 (thing-at-point--read-from-whole-string obj))
593 obj)))
592 (if (or (not pred) (funcall pred sexp)) sexp))) 594 (if (or (not pred) (funcall pred sexp)) sexp)))
593 595
594;;;###autoload 596;;;###autoload