]> code.delx.au - gnu-emacs/blobdiff - lisp/thingatpt.el
(decipher-mode-map): Use command remapping instead of
[gnu-emacs] / lisp / thingatpt.el
index 214f6dcfde179158c1d5ba758472d8a86e79958a..47caf02b03a3340de270f00f81526c8969595bba 100644 (file)
@@ -1,8 +1,10 @@
-;;; 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
 
@@ -54,7 +56,7 @@
   "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))))
 
@@ -197,13 +199,13 @@ a symbol as a valid 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 \"'()<>[^`{}.,;]+"
-  "A regular expression probably matching the host, path or e-mail part of a URL.")
+  "A regular expression probably matching the host and filename or e-mail part of a URL.")
 
 (defvar thing-at-point-short-url-regexp
   (concat "[-A-Za-z0-9.]+" thing-at-point-url-path-regexp)
@@ -211,10 +213,21 @@ a symbol as a valid THING."
 Hostname matching is stricter in this case than for
 ``thing-at-point-url-regexp''.")
 
+(defvar thing-at-point-uri-schemes
+  ;; Officials from http://www.iana.org/assignments/uri-schemes
+  '("ftp://" "http://" "gopher://" "mailto:" "news:" "nntp:"
+    "telnet://" "wais://" "file:/" "prospero:" "z39.50s:" "z39.50r:"
+    "cid:" "mid:" "vemmi:" "service:" "imap:" "nfs:" "acap:" "rtsp:"
+    "tip:" "pop:" "data:" "dav:" "opaquelocktoken:" "sip:" "tel:" "fax:"
+    "modem:" "ldap:" "https://" "soap.beep:" "soap.beeps:" "urn:" "go:"
+    "afs:" "tn3270:" "mailserver:"
+  ;; Compatibility
+    "snews:")
+  "Uniform Resource Identifier (URI) Schemes")
+
 (defvar thing-at-point-url-regexp
-  (concat
-   "\\(https?://\\|ftp://\\|gopher://\\|telnet://\\|wais://\\|file:/\\|s?news:\\|mailto:\\)"
-   thing-at-point-url-path-regexp)
+  (concat "\\<\\(" (mapconcat 'identity thing-at-point-uri-schemes "\\|") "\\)"
+          thing-at-point-url-path-regexp)
   "A regular expression probably matching a complete URL.")
 
 (defvar thing-at-point-markedup-url-regexp
@@ -334,8 +347,8 @@ point."
 
 ;;  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 
 
@@ -371,7 +384,8 @@ Signal an error if the entire string was not used."
   (let* ((read-data (read-from-string str))
         (more-left 
          (condition-case nil
-             (progn (read-from-string (substring str (cdr read-data)))
+             ;; The call to `ignore' suppresses a compiler warning.
+             (progn (ignore (read-from-string (substring str (cdr read-data))))
                     t)
            (end-of-file nil))))
     (if more-left
@@ -393,4 +407,4 @@ Signal an error if the entire string was not used."
 ;;;###autoload
 (defun list-at-point ()   (form-at-point 'list 'listp))
 
-;; thingatpt.el ends here.
+;;; thingatpt.el ends here