aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGlenn Morris2015-06-10 19:07:09 -0400
committerGlenn Morris2015-06-10 19:07:09 -0400
commitcabaa992fa7f7f1bcde79be8c202d54a41a52c9f (patch)
treec4023cefab237a64181f9bba56f1c65abf58a909
parent7c24a2c2101cd54f9bfdbe61daddd068b556afb0 (diff)
downloademacs-cabaa992fa7f7f1bcde79be8c202d54a41a52c9f.tar.gz
emacs-cabaa992fa7f7f1bcde79be8c202d54a41a52c9f.zip
Slight namespace cleanup for thingatpt.el.
* lisp/thingatpt.el (thing-at-point--in-string-p) (thing-at-point--end-of-sexp, thing-at-point--beginning-of-sexp) (thing-at-point--read-from-whole-string): Rename from old versions without "thing-at-point--" prefix. Keep old versions as obsolete aliases. Update all uses.
-rw-r--r--lisp/thingatpt.el40
1 files changed, 27 insertions, 13 deletions
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index 7fdb32c1ddf..ac4a3d342d7 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -177,36 +177,45 @@ The bounds of THING are determined by `bounds-of-thing-at-point'."
177 177
178;; Sexps 178;; Sexps
179 179
180(defun in-string-p () 180(defun thing-at-point--in-string-p ()
181 "Return non-nil if point is in a string. 181 "Return non-nil if point is in a string."
182\[This is an internal function.]"
183 (declare (obsolete "use (nth 3 (syntax-ppss)) instead." "25.1")) 182 (declare (obsolete "use (nth 3 (syntax-ppss)) instead." "25.1"))
184 (let ((orig (point))) 183 (let ((orig (point)))
185 (save-excursion 184 (save-excursion
186 (beginning-of-defun) 185 (beginning-of-defun)
187 (nth 3 (parse-partial-sexp (point) orig))))) 186 (nth 3 (parse-partial-sexp (point) orig)))))
188 187
189(defun end-of-sexp () 188(define-obsolete-function-alias 'in-string-p
190 "Move point to the end of the current sexp. 189 'thing-at-point--in-string-p "25.1"
191\[This is an internal function.]" 190 "This is an internal thingatpt function and should not be used.")
191
192(defun thing-at-point--end-of-sexp ()
193 "Move point to the end of the current sexp."
192 (let ((char-syntax (syntax-after (point)))) 194 (let ((char-syntax (syntax-after (point))))
193 (if (or (eq char-syntax ?\)) 195 (if (or (eq char-syntax ?\))
194 (and (eq char-syntax ?\") (nth 3 (syntax-ppss)))) 196 (and (eq char-syntax ?\") (nth 3 (syntax-ppss))))
195 (forward-char 1) 197 (forward-char 1)
196 (forward-sexp 1)))) 198 (forward-sexp 1))))
197 199
198(put 'sexp 'end-op 'end-of-sexp) 200(define-obsolete-function-alias 'end-of-sexp
201 'thing-at-point--end-of-sexp "25.1"
202 "This is an internal thingatpt function and should not be used.")
203
204(put 'sexp 'end-op 'thing-at-point--end-of-sexp)
199 205
200(defun beginning-of-sexp () 206(defun thing-at-point--beginning-of-sexp ()
201 "Move point to the beginning of the current sexp. 207 "Move point to the beginning of the current sexp."
202\[This is an internal function.]"
203 (let ((char-syntax (char-syntax (char-before)))) 208 (let ((char-syntax (char-syntax (char-before))))
204 (if (or (eq char-syntax ?\() 209 (if (or (eq char-syntax ?\()
205 (and (eq char-syntax ?\") (nth 3 (syntax-ppss)))) 210 (and (eq char-syntax ?\") (nth 3 (syntax-ppss))))
206 (forward-char -1) 211 (forward-char -1)
207 (forward-sexp -1)))) 212 (forward-sexp -1))))
208 213
209(put 'sexp 'beginning-op 'beginning-of-sexp) 214(define-obsolete-function-alias 'beginning-of-sexp
215 'thing-at-point--beginning-of-sexp "25.1"
216 "This is an internal thingatpt function and should not be used.")
217
218(put 'sexp 'beginning-op 'thing-at-point--beginning-of-sexp)
210 219
211;; Lists 220;; Lists
212 221
@@ -551,7 +560,7 @@ with angle brackets.")
551 "Return the sentence at point. See `thing-at-point'." 560 "Return the sentence at point. See `thing-at-point'."
552 (thing-at-point 'sentence)) 561 (thing-at-point 'sentence))
553 562
554(defun read-from-whole-string (str) 563(defun thing-at-point--read-from-whole-string (str)
555 "Read a Lisp expression from STR. 564 "Read a Lisp expression from STR.
556Signal an error if the entire string was not used." 565Signal an error if the entire string was not used."
557 (let* ((read-data (read-from-string str)) 566 (let* ((read-data (read-from-string str))
@@ -565,9 +574,14 @@ Signal an error if the entire string was not used."
565 (error "Can't read whole string") 574 (error "Can't read whole string")
566 (car read-data)))) 575 (car read-data))))
567 576
577(define-obsolete-function-alias 'read-from-whole-string
578 'thing-at-point--read-from-whole-string "25.1"
579 "This is an internal thingatpt function and should not be used.")
580
568(defun form-at-point (&optional thing pred) 581(defun form-at-point (&optional thing pred)
569 (let ((sexp (ignore-errors 582 (let ((sexp (ignore-errors
570 (read-from-whole-string (thing-at-point (or thing 'sexp)))))) 583 (thing-at-point--read-from-whole-string
584 (thing-at-point (or thing 'sexp))))))
571 (if (or (not pred) (funcall pred sexp)) sexp))) 585 (if (or (not pred) (funcall pred sexp)) sexp)))
572 586
573;;;###autoload 587;;;###autoload