;;; thingatpt.el --- get the `thing' at point
-;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 2000,
-;; 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-;; Free Software Foundation, Inc.
+;; Copyright (C) 1991-1998, 2000-2011 Free Software Foundation, Inc.
;; Author: Mike Williams <mikew@gopher.dosli.govt.nz>
;; Maintainer: FSF
;; Lists
-(put 'list 'end-op (lambda () (up-list 1)))
-(put 'list 'beginning-op 'backward-sexp)
+(put 'list 'bounds-of-thing-at-point 'thing-at-point-bounds-of-list-at-point)
+
+(defun thing-at-point-bounds-of-list-at-point ()
+ (save-excursion
+ (let ((opoint (point))
+ (beg (condition-case nil
+ (progn (up-list -1)
+ (point))
+ (error nil))))
+ (condition-case nil
+ (if beg
+ (progn (forward-sexp)
+ (cons beg (point)))
+ ;; Are we are at the beginning of a top-level sexp?
+ (forward-sexp)
+ (let ((end (point)))
+ (backward-sexp)
+ (if (>= opoint (point))
+ (cons opoint end))))
+ (error nil)))))
;; Filenames and URLs www.com/foo%32bar
"Return the Lisp list at point, or nil if none is found."
(form-at-point 'list 'listp))
-;; arch-tag: bb65a163-dae2-4055-aedc-fe11f497f698
;;; thingatpt.el ends here