]> code.delx.au - gnu-emacs/blobdiff - lisp/thingatpt.el
* emacs-lisp/benchmark.el (benchmark-elapse): Use float-time.
[gnu-emacs] / lisp / thingatpt.el
index a56c3e4d501c938442e39c44d787dac755e22d1f..a7ff23949fe57e35e3289f697ea1dcc9a162e6f8 100644 (file)
@@ -89,18 +89,19 @@ of the textual entity that was found."
              (or (get thing 'beginning-op)
                  (lambda () (forward-thing thing -1))))
            (let ((beg (point)))
-             (if (not (and beg (> beg orig)))
+             (if (<= beg orig)
                  ;; If that brings us all the way back to ORIG,
                  ;; it worked.  But END may not be the real end.
                  ;; So find the real end that corresponds to BEG.
+                  ;; FIXME: in which cases can `real-end' differ from `end'?
                  (let ((real-end
                         (progn
                           (funcall
                            (or (get thing 'end-op)
                                 (lambda () (forward-thing thing 1))))
                           (point))))
-                   (if (and beg real-end (<= beg orig) (<= orig real-end))
-                       (cons beg real-end)))
+                   (when (and (<= orig real-end) (< beg real-end))
+                      (cons beg real-end)))
                (goto-char orig)
                ;; Try a second time, moving backward first and then forward,
                ;; so that we can find a thing that ends at ORIG.
@@ -117,7 +118,7 @@ of the textual entity that was found."
                          (or (get thing 'beginning-op)
                               (lambda () (forward-thing thing -1))))
                         (point))))
-                 (if (and real-beg end (<= real-beg orig) (<= orig end))
+                 (if (and (<= real-beg orig) (<= orig end) (< real-beg end))
                      (cons real-beg end))))))
        (error nil)))))
 
@@ -234,7 +235,7 @@ a symbol as a valid THING."
   "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)
+  (concat "[-A-Za-z0-9]+\\.[-A-Za-z0-9.]+" thing-at-point-url-path-regexp)
   "A regular expression probably matching a URL without an access scheme.
 Hostname matching is stricter in this case than for
 ``thing-at-point-url-regexp''.")
@@ -401,7 +402,7 @@ with angle brackets.")
       (re-search-forward "[ \t]+\\|\n" nil 'move arg)
     (while (< arg 0)
       (if (re-search-backward "[ \t]+\\|\n" nil 'move)
-         (or (eq (char-after (match-beginning 0)) 10)
+         (or (eq (char-after (match-beginning 0)) ?\n)
              (skip-chars-backward " \t")))
       (setq arg (1+ arg)))))