diff options
| author | Richard M. Stallman | 2003-02-15 19:26:25 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-02-15 19:26:25 +0000 |
| commit | 95a85681fb5c8ba01d06758e8f85ea798b3f6943 (patch) | |
| tree | 4ab2cdc8a180eeb751ddea072b18dd4ab207cd09 | |
| parent | 207d5f1794438a7f76a811ef0916914e96812105 (diff) | |
| download | emacs-95a85681fb5c8ba01d06758e8f85ea798b3f6943.tar.gz emacs-95a85681fb5c8ba01d06758e8f85ea798b3f6943.zip | |
Many doc fixes.
(ffap-replace-file-component):
Renamed from ffap-replace-path-component. Callers changed.
(ffap-host-to-filename): Renamed from ffap-host-to-path. Callers chgd.
| -rw-r--r-- | lisp/ffap.el | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/lisp/ffap.el b/lisp/ffap.el index 2d481a5e46f..2ebb21e6bcf 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el | |||
| @@ -80,11 +80,11 @@ | |||
| 80 | 80 | ||
| 81 | ;;; Todo list: | 81 | ;;; Todo list: |
| 82 | ;; * use kpsewhich | 82 | ;; * use kpsewhich |
| 83 | ;; * let "/path/file#key" jump to key (tag or regexp) in /path/file | 83 | ;; * let "/dir/file#key" jump to key (tag or regexp) in /dir/file |
| 84 | ;; * find file of symbol if TAGS is loaded (like above) | 84 | ;; * find file of symbol if TAGS is loaded (like above) |
| 85 | ;; * break long menus into multiple panes (like imenu?) | 85 | ;; * break long menus into multiple panes (like imenu?) |
| 86 | ;; * notice node in "(dired)Virtual Dired" (quotes, parentheses, whitespace) | 86 | ;; * notice node in "(dired)Virtual Dired" (quotes, parentheses, whitespace) |
| 87 | ;; * notice "machine.dom blah blah blah path/file" (how?) | 87 | ;; * notice "machine.dom blah blah blah dir/file" (how?) |
| 88 | ;; * as w3 becomes standard, rewrite to rely more on its functions | 88 | ;; * as w3 becomes standard, rewrite to rely more on its functions |
| 89 | ;; * regexp options for ffap-string-at-point, like font-lock (MCOOK) | 89 | ;; * regexp options for ffap-string-at-point, like font-lock (MCOOK) |
| 90 | ;; * v19: could replace `ffap-locate-file' with a quieter `locate-library' | 90 | ;; * v19: could replace `ffap-locate-file' with a quieter `locate-library' |
| @@ -124,26 +124,26 @@ Otherwise return nil (or the optional DEFAULT value)." | |||
| 124 | ;; This used to test for ange-ftp or efs being present, but it should be | 124 | ;; This used to test for ange-ftp or efs being present, but it should be |
| 125 | ;; harmless (and simpler) to give it this value unconditionally. | 125 | ;; harmless (and simpler) to give it this value unconditionally. |
| 126 | "\\`/[^/:]+:" | 126 | "\\`/[^/:]+:" |
| 127 | "*Paths matching this regexp are treated as remote ftp paths by ffap. | 127 | "*File names matching this regexp are treated as remote ffap. |
| 128 | If nil, ffap neither recognizes nor generates such paths." | 128 | If nil, ffap neither recognizes nor generates such names." |
| 129 | :type '(choice (const :tag "Disable" nil) | 129 | :type '(choice (const :tag "Disable" nil) |
| 130 | (const :tag "Standard" "\\`/[^/:]+:") | 130 | (const :tag "Standard" "\\`/[^/:]+:") |
| 131 | regexp) | 131 | regexp) |
| 132 | :group 'ffap) | 132 | :group 'ffap) |
| 133 | 133 | ||
| 134 | (defcustom ffap-url-unwrap-local t | 134 | (defcustom ffap-url-unwrap-local t |
| 135 | "*If non-nil, convert `file:' url to local path before prompting." | 135 | "*If non-nil, convert `file:' URL to local file name before prompting." |
| 136 | :type 'boolean | 136 | :type 'boolean |
| 137 | :group 'ffap) | 137 | :group 'ffap) |
| 138 | 138 | ||
| 139 | (defcustom ffap-url-unwrap-remote t | 139 | (defcustom ffap-url-unwrap-remote t |
| 140 | "*If non-nil, convert `ftp:' url to remote path before prompting. | 140 | "*If non-nil, convert `ftp:' URL to remote file name before prompting. |
| 141 | This is ignored if `ffap-ftp-regexp' is nil." | 141 | This is ignored if `ffap-ftp-regexp' is nil." |
| 142 | :type 'boolean | 142 | :type 'boolean |
| 143 | :group 'ffap) | 143 | :group 'ffap) |
| 144 | 144 | ||
| 145 | (defcustom ffap-ftp-default-user "anonymous" | 145 | (defcustom ffap-ftp-default-user "anonymous" |
| 146 | "*User name in ftp paths generated by `ffap-host-to-path'. | 146 | "*User name in ftp file names generated by `ffap-host-to-path'. |
| 147 | Note this name may be omitted if it equals the default | 147 | Note this name may be omitted if it equals the default |
| 148 | \(either `efs-default-user' or `ange-ftp-default-user'\)." | 148 | \(either `efs-default-user' or `ange-ftp-default-user'\)." |
| 149 | :type 'string | 149 | :type 'string |
| @@ -153,7 +153,7 @@ Note this name may be omitted if it equals the default | |||
| 153 | ;; Remote file access built into file system? HP rfa or Andrew afs: | 153 | ;; Remote file access built into file system? HP rfa or Andrew afs: |
| 154 | "\\`/\\(afs\\|net\\)/." | 154 | "\\`/\\(afs\\|net\\)/." |
| 155 | ;; afs only: (and (file-exists-p "/afs") "\\`/afs/.") | 155 | ;; afs only: (and (file-exists-p "/afs") "\\`/afs/.") |
| 156 | "*Matching paths are treated as remote. nil to disable." | 156 | "*Matching file names are treated as remote. Use nil to disable." |
| 157 | :type 'regexp | 157 | :type 'regexp |
| 158 | :group 'ffap) | 158 | :group 'ffap) |
| 159 | 159 | ||
| @@ -434,7 +434,7 @@ Returned values: | |||
| 434 | 434 | ||
| 435 | ;;; Possibly Remote Resources: | 435 | ;;; Possibly Remote Resources: |
| 436 | 436 | ||
| 437 | (defun ffap-replace-path-component (fullname name) | 437 | (defun ffap-replace-file-component (fullname name) |
| 438 | "In remote FULLNAME, replace path with NAME. May return nil." | 438 | "In remote FULLNAME, replace path with NAME. May return nil." |
| 439 | ;; Use ange-ftp or efs if loaded, but do not load them otherwise. | 439 | ;; Use ange-ftp or efs if loaded, but do not load them otherwise. |
| 440 | (let (found) | 440 | (let (found) |
| @@ -446,9 +446,9 @@ Returned values: | |||
| 446 | ange-ftp-replace-name-component | 446 | ange-ftp-replace-name-component |
| 447 | )) | 447 | )) |
| 448 | (and found | 448 | (and found |
| 449 | (fset 'ffap-replace-path-component found) | 449 | (fset 'ffap-replace-file-component found) |
| 450 | (funcall found fullname name)))) | 450 | (funcall found fullname name)))) |
| 451 | ;; (ffap-replace-path-component "/who@foo.com:/whatever" "/new") | 451 | ;; (ffap-replace-file-component "/who@foo.com:/whatever" "/new") |
| 452 | 452 | ||
| 453 | (defun ffap-file-suffix (file) | 453 | (defun ffap-file-suffix (file) |
| 454 | "Return trailing `.foo' suffix of FILE, or nil if none." | 454 | "Return trailing `.foo' suffix of FILE, or nil if none." |
| @@ -485,12 +485,12 @@ The optional NOMODIFY argument suppresses the extra search." | |||
| 485 | (defun ffap-file-remote-p (filename) | 485 | (defun ffap-file-remote-p (filename) |
| 486 | "If FILENAME looks remote, return it (maybe slightly improved)." | 486 | "If FILENAME looks remote, return it (maybe slightly improved)." |
| 487 | ;; (ffap-file-remote-p "/user@foo.bar.com:/pub") | 487 | ;; (ffap-file-remote-p "/user@foo.bar.com:/pub") |
| 488 | ;; (ffap-file-remote-p "/cssun.mathcs.emory.edu://path") | 488 | ;; (ffap-file-remote-p "/cssun.mathcs.emory.edu://dir") |
| 489 | ;; (ffap-file-remote-p "/ffap.el:80") | 489 | ;; (ffap-file-remote-p "/ffap.el:80") |
| 490 | (or (and ffap-ftp-regexp | 490 | (or (and ffap-ftp-regexp |
| 491 | (string-match ffap-ftp-regexp filename) | 491 | (string-match ffap-ftp-regexp filename) |
| 492 | ;; Convert "/host.com://path" to "/host:/path", to handle a dieing | 492 | ;; Convert "/host.com://dir" to "/host:/dir", to handle a dieing |
| 493 | ;; practice of advertising ftp paths as "host.dom://path". | 493 | ;; practice of advertising ftp files as "host.dom://filename". |
| 494 | (if (string-match "//" filename) | 494 | (if (string-match "//" filename) |
| 495 | ;; (replace-match "/" nil nil filename) | 495 | ;; (replace-match "/" nil nil filename) |
| 496 | (concat (substring filename 0 (1+ (match-beginning 0))) | 496 | (concat (substring filename 0 (1+ (match-beginning 0))) |
| @@ -505,7 +505,7 @@ The optional NOMODIFY argument suppresses the extra search." | |||
| 505 | (let ((mach (ffap-string-at-point 'machine))) | 505 | (let ((mach (ffap-string-at-point 'machine))) |
| 506 | (and (ffap-machine-p mach) mach))) | 506 | (and (ffap-machine-p mach) mach))) |
| 507 | 507 | ||
| 508 | (defsubst ffap-host-to-path (host) | 508 | (defsubst ffap-host-to-filename (host) |
| 509 | "Convert HOST to something like \"/USER@HOST:\" or \"/HOST:\". | 509 | "Convert HOST to something like \"/USER@HOST:\" or \"/HOST:\". |
| 510 | Looks at `ffap-ftp-default-user', returns \"\" for \"localhost\"." | 510 | Looks at `ffap-ftp-default-user', returns \"\" for \"localhost\"." |
| 511 | (if (equal host "localhost") | 511 | (if (equal host "localhost") |
| @@ -518,7 +518,7 @@ Looks at `ffap-ftp-default-user', returns \"\" for \"localhost\"." | |||
| 518 | (concat "/" user (and user "@") host ":")))) | 518 | (concat "/" user (and user "@") host ":")))) |
| 519 | 519 | ||
| 520 | (defun ffap-fixup-machine (mach) | 520 | (defun ffap-fixup-machine (mach) |
| 521 | ;; Convert a hostname into an url, an ftp path, or nil. | 521 | ;; Convert a hostname into an url, an ftp file name, or nil. |
| 522 | (cond | 522 | (cond |
| 523 | ((not (and ffap-url-regexp (stringp mach))) nil) | 523 | ((not (and ffap-url-regexp (stringp mach))) nil) |
| 524 | ;; gopher.well.com | 524 | ;; gopher.well.com |
| @@ -528,7 +528,7 @@ Looks at `ffap-ftp-default-user', returns \"\" for \"localhost\"." | |||
| 528 | ((and (string-match "\\`w\\(ww\\|eb\\)[-.]" mach)) | 528 | ((and (string-match "\\`w\\(ww\\|eb\\)[-.]" mach)) |
| 529 | (concat "http://" mach "/")) | 529 | (concat "http://" mach "/")) |
| 530 | ;; More cases? Maybe "telnet:" for archie? | 530 | ;; More cases? Maybe "telnet:" for archie? |
| 531 | (ffap-ftp-regexp (ffap-host-to-path mach)) | 531 | (ffap-ftp-regexp (ffap-host-to-filename mach)) |
| 532 | )) | 532 | )) |
| 533 | 533 | ||
| 534 | (defvar ffap-newsgroup-regexp "^[a-z]+\\.[-+a-z_0-9.]+$" | 534 | (defvar ffap-newsgroup-regexp "^[a-z]+\\.[-+a-z_0-9.]+$" |
| @@ -580,7 +580,7 @@ Looks at `ffap-ftp-default-user', returns \"\" for \"localhost\"." | |||
| 580 | "Return URL as a remote file, or nil. Ignores `ffap-url-regexp'." | 580 | "Return URL as a remote file, or nil. Ignores `ffap-url-regexp'." |
| 581 | (and (string-match "\\`\\(ftp\\|file\\)://\\([^:/]+\\):?\\(/.*\\)" url) | 581 | (and (string-match "\\`\\(ftp\\|file\\)://\\([^:/]+\\):?\\(/.*\\)" url) |
| 582 | (concat | 582 | (concat |
| 583 | (ffap-host-to-path (substring url (match-beginning 2) (match-end 2))) | 583 | (ffap-host-to-filename (substring url (match-beginning 2) (match-end 2))) |
| 584 | (substring url (match-beginning 3) (match-end 3))))) | 584 | (substring url (match-beginning 3) (match-end 3))))) |
| 585 | ;; Test: (ffap-url-unwrap-remote "ftp://foo.com/bar.boz") | 585 | ;; Test: (ffap-url-unwrap-remote "ftp://foo.com/bar.boz") |
| 586 | 586 | ||
| @@ -596,10 +596,10 @@ Looks at `ffap-ftp-default-user', returns \"\" for \"localhost\"." | |||
| 596 | (url))) | 596 | (url))) |
| 597 | 597 | ||
| 598 | 598 | ||
| 599 | ;;; Path Handling: | 599 | ;;; File Name Handling: |
| 600 | ;; | 600 | ;; |
| 601 | ;; The upcoming ffap-alist actions need various utilities to prepare | 601 | ;; The upcoming ffap-alist actions need various utilities to prepare |
| 602 | ;; and search paths of directories. Too many features here. | 602 | ;; and search directories. Too many features here. |
| 603 | 603 | ||
| 604 | ;; (defun ffap-last (l) (while (cdr l) (setq l (cdr l))) l) | 604 | ;; (defun ffap-last (l) (while (cdr l) (setq l (cdr l))) l) |
| 605 | ;; (defun ffap-splice (func inlist) | 605 | ;; (defun ffap-splice (func inlist) |
| @@ -901,7 +901,7 @@ If t, `ffap-tex-init' will initialize this when needed.") | |||
| 901 | (member (ffap-string-around) '("||" "|\n"))) | 901 | (member (ffap-string-around) '("||" "|\n"))) |
| 902 | (concat | 902 | (concat |
| 903 | ;; lispdir.el may not be loaded yet: | 903 | ;; lispdir.el may not be loaded yet: |
| 904 | (ffap-host-to-path | 904 | (ffap-host-to-filename |
| 905 | (ffap-soft-value "elisp-archive-host" | 905 | (ffap-soft-value "elisp-archive-host" |
| 906 | "archive.cis.ohio-state.edu")) | 906 | "archive.cis.ohio-state.edu")) |
| 907 | (file-name-as-directory | 907 | (file-name-as-directory |
| @@ -910,7 +910,7 @@ If t, `ffap-tex-init' will initialize this when needed.") | |||
| 910 | (substring name 2)))) | 910 | (substring name 2)))) |
| 911 | 911 | ||
| 912 | (defvar ffap-rfc-path | 912 | (defvar ffap-rfc-path |
| 913 | (concat (ffap-host-to-path "ds.internic.net") "/rfc/rfc%s.txt")) | 913 | (concat (ffap-host-to-filename "ds.internic.net") "/rfc/rfc%s.txt")) |
| 914 | 914 | ||
| 915 | (defun ffap-rfc (name) | 915 | (defun ffap-rfc (name) |
| 916 | (format ffap-rfc-path | 916 | (format ffap-rfc-path |
| @@ -1077,7 +1077,7 @@ The two subexpressions are the KEY and VALUE.") | |||
| 1077 | ;; Icky regexp avoids: default: 123: foo::bar cs:pub | 1077 | ;; Icky regexp avoids: default: 123: foo::bar cs:pub |
| 1078 | ;; It does match on: mic@cs: cs:/pub mathcs.emory.edu: (point at end) | 1078 | ;; It does match on: mic@cs: cs:/pub mathcs.emory.edu: (point at end) |
| 1079 | "\\`\\([^:@]+@[^:@]+:\\|[^@.:]+\\.[^@:]+:\\|[^:]+:[~/]\\)\\([^:]\\|\\'\\)") | 1079 | "\\`\\([^:@]+@[^:@]+:\\|[^@.:]+\\.[^@:]+:\\|[^:]+:[~/]\\)\\([^:]\\|\\'\\)") |
| 1080 | "Strings matching this are coerced to ftp paths by ffap. | 1080 | "Strings matching this are coerced to ftp file names by ffap. |
| 1081 | That is, ffap just prepends \"/\". Set to nil to disable.") | 1081 | That is, ffap just prepends \"/\". Set to nil to disable.") |
| 1082 | 1082 | ||
| 1083 | (defun ffap-file-at-point nil | 1083 | (defun ffap-file-at-point nil |
| @@ -1087,7 +1087,7 @@ If the filename is not obvious, it also tries `ffap-alist', | |||
| 1087 | which may actually result in an url rather than a filename." | 1087 | which may actually result in an url rather than a filename." |
| 1088 | ;; Note: this function does not need to look for url's, just | 1088 | ;; Note: this function does not need to look for url's, just |
| 1089 | ;; filenames. On the other hand, it is responsible for converting | 1089 | ;; filenames. On the other hand, it is responsible for converting |
| 1090 | ;; a pseudo-url "site.com://path" to an ftp path | 1090 | ;; a pseudo-url "site.com://dir" to an ftp file name |
| 1091 | (let* ((case-fold-search t) ; url prefixes are case-insensitive | 1091 | (let* ((case-fold-search t) ; url prefixes are case-insensitive |
| 1092 | (data (match-data)) | 1092 | (data (match-data)) |
| 1093 | (string (ffap-string-at-point)) ; uses mode alist | 1093 | (string (ffap-string-at-point)) ; uses mode alist |
| @@ -1115,7 +1115,7 @@ which may actually result in an url rather than a filename." | |||
| 1115 | ;; Accept remote names without actual checking (too slow): | 1115 | ;; Accept remote names without actual checking (too slow): |
| 1116 | ((if abs | 1116 | ((if abs |
| 1117 | (ffap-file-remote-p name) | 1117 | (ffap-file-remote-p name) |
| 1118 | ;; Try adding a leading "/" (common omission in ftp paths): | 1118 | ;; Try adding a leading "/" (common omission in ftp file names): |
| 1119 | (and | 1119 | (and |
| 1120 | ffap-ftp-sans-slash-regexp | 1120 | ffap-ftp-sans-slash-regexp |
| 1121 | (string-match ffap-ftp-sans-slash-regexp name) | 1121 | (string-match ffap-ftp-sans-slash-regexp name) |
| @@ -1144,7 +1144,7 @@ which may actually result in an url rather than a filename." | |||
| 1144 | try)) | 1144 | try)) |
| 1145 | ;; Alist failed? Try to guess an active remote connection | 1145 | ;; Alist failed? Try to guess an active remote connection |
| 1146 | ;; from buffer variables, and try once more, both as an | 1146 | ;; from buffer variables, and try once more, both as an |
| 1147 | ;; absolute and relative path on that remote host. | 1147 | ;; absolute and relative file name on that remote host. |
| 1148 | ((let* (ffap-rfs-regexp ; suppress | 1148 | ((let* (ffap-rfs-regexp ; suppress |
| 1149 | (remote-dir | 1149 | (remote-dir |
| 1150 | (cond | 1150 | (cond |
| @@ -1162,10 +1162,10 @@ which may actually result in an url rather than a filename." | |||
| 1162 | (or | 1162 | (or |
| 1163 | (and (string-match "\\`\\(/?~?ftp\\)/" name) | 1163 | (and (string-match "\\`\\(/?~?ftp\\)/" name) |
| 1164 | (ffap-file-exists-string | 1164 | (ffap-file-exists-string |
| 1165 | (ffap-replace-path-component | 1165 | (ffap-replace-file-component |
| 1166 | remote-dir (substring name (match-end 1))))) | 1166 | remote-dir (substring name (match-end 1))))) |
| 1167 | (ffap-file-exists-string | 1167 | (ffap-file-exists-string |
| 1168 | (ffap-replace-path-component remote-dir name)))))) | 1168 | (ffap-replace-file-component remote-dir name)))))) |
| 1169 | ) | 1169 | ) |
| 1170 | (set-match-data data)))) | 1170 | (set-match-data data)))) |
| 1171 | 1171 | ||