-;;; thingatpt.el --- Get the `thing' at point
+;;; thingatpt.el --- get the `thing' at point
-;; Copyright (C) 1991,92,93,94,95,96,97,1998 Free Software Foundation, Inc.
+;; Copyright (C) 1991,92,93,94,95,96,97,1998,2000
+;; Free Software Foundation, Inc.
;; Author: Mike Williams <mikew@gopher.dosli.govt.nz>
+;; Maintainer: FSF
;; Keywords: extensions, matching, mouse
;; Created: Thu Mar 28 13:48:23 1991
"Move forward to the end of the next THING."
(let ((forward-op (or (get thing 'forward-op)
(intern-soft (format "forward-%s" thing)))))
- (if (fboundp forward-op)
+ (if (functionp forward-op)
(funcall forward-op (or n 1))
(error "Can't determine how to move over a %s" thing))))
"Characters allowable in filenames.")
(put 'filename 'end-op
- '(lambda () (skip-chars-forward thing-at-point-file-name-chars)))
+ (lambda () (skip-chars-forward thing-at-point-file-name-chars)))
(put 'filename 'beginning-op
- '(lambda () (skip-chars-backward thing-at-point-file-name-chars)))
+ (lambda () (skip-chars-backward thing-at-point-file-name-chars)))
(defvar thing-at-point-url-path-regexp
"[^]\t\n \"'()<>[^`{}]*[^]\t\n \"'()<>[^`{}.,;]+"
(defvar thing-at-point-url-regexp
(concat
- "\\(https?://\\|ftp://\\|gopher://\\|telnet://\\|wais://\\|file:/\\|s?news:\\|mailto:\\)"
+ "\\<\\(https?://\\|ftp://\\|gopher://\\|telnet://\\|wais://\\|file:/\\|s?news:\\|mailto:\\)"
thing-at-point-url-path-regexp)
"A regular expression probably matching a complete URL.")
(match-end 0)))
(and strip (setq url (substring url 5 -1))) ; Drop "<URL:" & ">"
;; strip whitespace
- (while (string-match "\\s +\\|\n+" url)
+ (while (string-match "[ \t\n\r]+" url)
(setq url (replace-match "" t t url)))
(and short (setq url (concat (cond ((string-match "@" url)
"mailto:")
;; Buffer
-(put 'buffer 'end-op '(lambda () (goto-char (point-max))))
-(put 'buffer 'beginning-op '(lambda () (goto-char (point-min))))
+(put 'buffer 'end-op (lambda () (goto-char (point-max))))
+(put 'buffer 'beginning-op (lambda () (goto-char (point-min))))
;; Symbols
(error nil))))
(if (or (not pred) (funcall pred sexp)) sexp)))
+;;;###autoload
(defun sexp-at-point () (form-at-point 'sexp))
+;;;###autoload
(defun symbol-at-point () (form-at-point 'sexp 'symbolp))
+;;;###autoload
(defun number-at-point () (form-at-point 'sexp 'numberp))
+;;;###autoload
(defun list-at-point () (form-at-point 'list 'listp))
-;; thingatpt.el ends here.
+;;; thingatpt.el ends here