emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 9640e9f: form-at-point work for all kind of THINGS


From: Tino Calancha
Subject: [Emacs-diffs] master 9640e9f: form-at-point work for all kind of THINGS
Date: Tue, 11 Oct 2016 02:48:40 +0000 (UTC)

branch: master
commit 9640e9f4e95cd95c04875e90a4ff638e1e51f977
Author: Tino Calancha <address@hidden>
Commit: Tino Calancha <address@hidden>

    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 df5c52d..6d1014b 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]