aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2007-01-10 23:48:04 +0000
committerStefan Monnier2007-01-10 23:48:04 +0000
commit5362ba53398cbd2f8d81d226b2321fbc960ceb0f (patch)
treefda3160817c089b419142aa606e7550ef861ddd0
parentb4ec8cb4e66f94547e8215a1c1eb6cda3b83ca63 (diff)
downloademacs-5362ba53398cbd2f8d81d226b2321fbc960ceb0f.tar.gz
emacs-5362ba53398cbd2f8d81d226b2321fbc960ceb0f.zip
(ffap-next-regexp, ffap-machine-p, ffap-newsgroup-regexp)
(ffap-newsgroup-p, ffap-alist, ffap-string-at-point-mode-alist) (ffap-url-at-point): Use char-classes rather than "a-z".
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/ffap.el26
2 files changed, 19 insertions, 13 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index f24de58fbb7..5e0496e1fe0 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12007-01-10 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * ffap.el (ffap-next-regexp, ffap-machine-p, ffap-newsgroup-regexp)
4 (ffap-newsgroup-p, ffap-alist, ffap-string-at-point-mode-alist)
5 (ffap-url-at-point): Use char-classes rather than "a-z".
6
12007-01-10 Juanma Barranquero <lekktu@gmail.com> 72007-01-10 Juanma Barranquero <lekktu@gmail.com>
2 8
3 * ediff-init.el (ediff-autostore-merges): 9 * ediff-init.el (ediff-autostore-merges):
diff --git a/lisp/ffap.el b/lisp/ffap.el
index a36ba58e577..e49c77f4d47 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1,7 +1,7 @@
1;;; ffap.el --- find file (or url) at point 1;;; ffap.el --- find file (or url) at point
2 2
3;; Copyright (C) 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004, 3;; Copyright (C) 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2004,
4;; 2005, 2006 Free Software Foundation, Inc. 4;; 2005, 2006, 2007 Free Software Foundation, Inc.
5 5
6;; Author: Michelangelo Grigni <mic@mathcs.emory.edu> 6;; Author: Michelangelo Grigni <mic@mathcs.emory.edu>
7;; Maintainer: FSF 7;; Maintainer: FSF
@@ -310,7 +310,7 @@ For a fancy alternative, get `ffap-url.el'."
310 ;; 310 ;;
311 ;; It pays to put a big fancy regexp here, since ffap-guesser is 311 ;; It pays to put a big fancy regexp here, since ffap-guesser is
312 ;; much more time-consuming than regexp searching: 312 ;; much more time-consuming than regexp searching:
313 "[/:.~a-zA-Z]/\\|@[a-zA-Z][-a-zA-Z0-9]*\\." 313 "[/:.~[:alpha:]]/\\|@[[:alpha:]][-[:alnum:]]*\\."
314 "*Regular expression governing movements of `ffap-next'." 314 "*Regular expression governing movements of `ffap-next'."
315 :type 'regexp 315 :type 'regexp
316 :group 'ffap) 316 :group 'ffap)
@@ -426,7 +426,7 @@ Returned values:
426 ;; (ffap-machine-p "mathcs" 5678 nil 'ping) 426 ;; (ffap-machine-p "mathcs" 5678 nil 'ping)
427 ;; (ffap-machine-p "foo.bonk" nil nil 'ping) 427 ;; (ffap-machine-p "foo.bonk" nil nil 'ping)
428 ;; (ffap-machine-p "foo.bonk.com" nil nil 'ping) 428 ;; (ffap-machine-p "foo.bonk.com" nil nil 'ping)
429 (if (or (string-match "[^-a-zA-Z0-9.]" host) ; Illegal chars (?) 429 (if (or (string-match "[^-[:alnum:].]" host) ; Illegal chars (?)
430 (not (string-match "[^0-9]" host))) ; 1: a number? 2: quick reject 430 (not (string-match "[^0-9]" host))) ; 1: a number? 2: quick reject
431 nil 431 nil
432 (let* ((domain 432 (let* ((domain
@@ -575,7 +575,7 @@ Looks at `ffap-ftp-default-user', returns \"\" for \"localhost\"."
575 (ffap-ftp-regexp (ffap-host-to-filename mach)) 575 (ffap-ftp-regexp (ffap-host-to-filename mach))
576 )) 576 ))
577 577
578(defvar ffap-newsgroup-regexp "^[a-z]+\\.[-+a-z_0-9.]+$" 578(defvar ffap-newsgroup-regexp "^[[:lower:]]+\\.[-+[:lower:]_0-9.]+$"
579 "Strings not matching this fail `ffap-newsgroup-p'.") 579 "Strings not matching this fail `ffap-newsgroup-p'.")
580(defvar ffap-newsgroup-heads ; entirely inadequate 580(defvar ffap-newsgroup-heads ; entirely inadequate
581 '("alt" "comp" "gnu" "misc" "news" "sci" "soc" "talk") 581 '("alt" "comp" "gnu" "misc" "news" "sci" "soc" "talk")
@@ -601,7 +601,7 @@ Looks at `ffap-ftp-default-user', returns \"\" for \"localhost\"."
601 (setq heads nil)) 601 (setq heads nil))
602 (error nil))) 602 (error nil)))
603 (or ret (not heads) 603 (or ret (not heads)
604 (let ((head (string-match "\\`\\([a-z]+\\)\\." string))) 604 (let ((head (string-match "\\`\\([[:lower:]]+\\)\\." string)))
605 (and head (setq head (substring string 0 (match-end 1))) 605 (and head (setq head (substring string 0 (match-end 1)))
606 (member head heads) 606 (member head heads)
607 (setq ret string)))) 607 (setq ret string))))
@@ -780,7 +780,7 @@ This uses ffap-file-exists-string, which may try adding suffixes from
780 ("" . ffap-completable) ; completion, slow on some systems 780 ("" . ffap-completable) ; completion, slow on some systems
781 ("\\.info\\'" . ffap-info) ; gzip.info 781 ("\\.info\\'" . ffap-info) ; gzip.info
782 ("\\`info/" . ffap-info-2) ; info/emacs 782 ("\\`info/" . ffap-info-2) ; info/emacs
783 ("\\`[-a-z]+\\'" . ffap-info-3) ; (emacs)Top [only in the parentheses] 783 ("\\`[-[:lower:]]+\\'" . ffap-info-3) ; (emacs)Top [only in the parentheses]
784 ("\\.elc?\\'" . ffap-el) ; simple.el, simple.elc 784 ("\\.elc?\\'" . ffap-el) ; simple.el, simple.elc
785 (emacs-lisp-mode . ffap-el-mode) ; rmail, gnus, simple, custom 785 (emacs-lisp-mode . ffap-el-mode) ; rmail, gnus, simple, custom
786 ;; (lisp-interaction-mode . ffap-el-mode) ; maybe 786 ;; (lisp-interaction-mode . ffap-el-mode) ; maybe
@@ -969,15 +969,15 @@ If t, `ffap-tex-init' will initialize this when needed.")
969 ;; Slightly controversial decisions: 969 ;; Slightly controversial decisions:
970 ;; * strip trailing "@" and ":" 970 ;; * strip trailing "@" and ":"
971 ;; * no commas (good for latex) 971 ;; * no commas (good for latex)
972 (file "--:$+<>@-Z_a-z~*?" "<@" "@>;.,!:") 972 (file "--:$+<>@-Z_[:lower:]~*?" "<@" "@>;.,!:")
973 ;; An url, or maybe a email/news message-id: 973 ;; An url, or maybe a email/news message-id:
974 (url "--:=&?$+@-Z_a-z~#,%;*" "^A-Za-z0-9" ":;.,!?") 974 (url "--:=&?$+@-Z_[:lower:]~#,%;*" "^[:alnum:]" ":;.,!?")
975 ;; Find a string that does *not* contain a colon: 975 ;; Find a string that does *not* contain a colon:
976 (nocolon "--9$+<>@-Z_a-z~" "<@" "@>;.,!?") 976 (nocolon "--9$+<>@-Z_[:lower:]~" "<@" "@>;.,!?")
977 ;; A machine: 977 ;; A machine:
978 (machine "-a-zA-Z0-9." "" ".") 978 (machine "-[:alnum:]." "" ".")
979 ;; Mathematica paths: allow backquotes 979 ;; Mathematica paths: allow backquotes
980 (math-mode ",-:$+<>@-Z_a-z~`" "<" "@>;.,!?`:") 980 (math-mode ",-:$+<>@-Z_[:lower:]~`" "<" "@>;.,!?`:")
981 ) 981 )
982 "Alist of \(MODE CHARS BEG END\), where MODE is a symbol, 982 "Alist of \(MODE CHARS BEG END\), where MODE is a symbol,
983possibly a major-mode name, or one of the symbol 983possibly a major-mode name, or one of the symbol
@@ -1062,7 +1062,7 @@ Assumes the buffer has not changed."
1062 (let ((name (ffap-string-at-point 'url))) 1062 (let ((name (ffap-string-at-point 'url)))
1063 (cond 1063 (cond
1064 ((string-match "^url:" name) (setq name (substring name 4))) 1064 ((string-match "^url:" name) (setq name (substring name 4)))
1065 ((and (string-match "\\`[^:</>@]+@[^:</>@]+[a-zA-Z0-9]\\'" name) 1065 ((and (string-match "\\`[^:</>@]+@[^:</>@]+[[:alnum:]]\\'" name)
1066 ;; "foo@bar": could be "mailto" or "news" (a Message-ID). 1066 ;; "foo@bar": could be "mailto" or "news" (a Message-ID).
1067 ;; Without "<>" it must be "mailto". Otherwise could be 1067 ;; Without "<>" it must be "mailto". Otherwise could be
1068 ;; either, so consult `ffap-foo-at-bar-prefix'. 1068 ;; either, so consult `ffap-foo-at-bar-prefix'.
@@ -1074,7 +1074,7 @@ Assumes the buffer has not changed."
1074 "mailto"))) 1074 "mailto")))
1075 (and prefix (setq name (concat prefix ":" name)))))) 1075 (and prefix (setq name (concat prefix ":" name))))))
1076 ((ffap-newsgroup-p name) (setq name (concat "news:" name))) 1076 ((ffap-newsgroup-p name) (setq name (concat "news:" name)))
1077 ((and (string-match "\\`[a-z0-9]+\\'" name) ; <mic> <root> <nobody> 1077 ((and (string-match "\\`[[:alnum:]]+\\'" name) ; <mic> <root> <nobody>
1078 (equal (ffap-string-around) "<>") 1078 (equal (ffap-string-around) "<>")
1079 ;; (ffap-user-p name): 1079 ;; (ffap-user-p name):
1080 (not (string-match "~" (expand-file-name (concat "~" name)))) 1080 (not (string-match "~" (expand-file-name (concat "~" name))))