Mercurial > emacs
comparison lisp/ffap.el @ 23352:0550057ebca1
Doc fixes.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Wed, 30 Sep 1998 19:06:27 +0000 |
parents | 8dda497e707d |
children | 362c52acd51f |
comparison
equal
deleted
inserted
replaced
23351:a8979439d44b | 23352:0550057ebca1 |
---|---|
33 ;; (`ffap-require-prefix' swaps these behaviors). This is useful for | 33 ;; (`ffap-require-prefix' swaps these behaviors). This is useful for |
34 ;; following references in situations such as mail or news buffers, | 34 ;; following references in situations such as mail or news buffers, |
35 ;; README's, MANIFEST's, and so on. Submit bugs or suggestions with | 35 ;; README's, MANIFEST's, and so on. Submit bugs or suggestions with |
36 ;; M-x ffap-bug. | 36 ;; M-x ffap-bug. |
37 ;; | 37 ;; |
38 ;; For the default installation, byte-compile ffap.el somewhere in | 38 ;; For the default installation, add these two lines to your .emacs file: |
39 ;; your `load-path' and add these two lines to your .emacs file: | |
40 ;; | 39 ;; |
41 ;; (require 'ffap) ; load the package | 40 ;; (require 'ffap) ; load the package |
42 ;; (ffap-bindings) ; do default key bindings | 41 ;; (ffap-bindings) ; do default key bindings |
43 ;; | 42 ;; |
44 ;; ffap-bindings makes the following global key bindings: | 43 ;; ffap-bindings makes the following global key bindings: |
131 (const :tag "Standard" "\\`/[^/:]+:") | 130 (const :tag "Standard" "\\`/[^/:]+:") |
132 regexp) | 131 regexp) |
133 :group 'ffap) | 132 :group 'ffap) |
134 | 133 |
135 (defcustom ffap-url-unwrap-local t | 134 (defcustom ffap-url-unwrap-local t |
136 "*If non-nil, convert \"file:\" url to local path before prompting." | 135 "*If non-nil, convert `file:' url to local path before prompting." |
137 :type 'boolean | 136 :type 'boolean |
138 :group 'ffap) | 137 :group 'ffap) |
139 | 138 |
140 (defcustom ffap-url-unwrap-remote t | 139 (defcustom ffap-url-unwrap-remote t |
141 "*If non-nil, convert \"ftp:\" url to remote path before prompting. | 140 "*If non-nil, convert `ftp:' url to remote path before prompting. |
142 This is ignored if `ffap-ftp-regexp' is nil." | 141 This is ignored if `ffap-ftp-regexp' is nil." |
143 :type 'boolean | 142 :type 'boolean |
144 :group 'ffap) | 143 :group 'ffap) |
145 | 144 |
146 (defcustom ffap-ftp-default-user "anonymous" | 145 (defcustom ffap-ftp-default-user "anonymous" |
230 ;; Remote control references: | 229 ;; Remote control references: |
231 ;; http://www.ncsa.uiuc.edu/SDG/Software/XMosaic/remote-control.html | 230 ;; http://www.ncsa.uiuc.edu/SDG/Software/XMosaic/remote-control.html |
232 ;; http://home.netscape.com/newsref/std/x-remote.html | 231 ;; http://home.netscape.com/newsref/std/x-remote.html |
233 "*A function of one argument, called by ffap to fetch an URL. | 232 "*A function of one argument, called by ffap to fetch an URL. |
234 Reasonable choices are `w3-fetch' or a `browse-url-*' function. | 233 Reasonable choices are `w3-fetch' or a `browse-url-*' function. |
235 For a fancy alternative, get ffap-url.el." | 234 For a fancy alternative, get `ffap-url.el'." |
236 :type '(choice (const w3-fetch) | 235 :type '(choice (const w3-fetch) |
237 (const browse-url) ; in recent versions of browse-url | 236 (const browse-url) ; in recent versions of browse-url |
238 (const browse-url-netscape) | 237 (const browse-url-netscape) |
239 (const browse-url-mosaic) | 238 (const browse-url-mosaic) |
240 function) | 239 function) |
332 | 331 |
333 ;; I cannot decide a "best" strategy here, so these are variables. In | 332 ;; I cannot decide a "best" strategy here, so these are variables. In |
334 ;; particular, if `Pinging...' is broken or takes too long on your | 333 ;; particular, if `Pinging...' is broken or takes too long on your |
335 ;; machine, try setting these all to accept or reject. | 334 ;; machine, try setting these all to accept or reject. |
336 (defcustom ffap-machine-p-local 'reject ; this happens often | 335 (defcustom ffap-machine-p-local 'reject ; this happens often |
337 "*A symbol, one of: `ping', `accept', `reject'. | 336 "*What `ffap-machine-p' does with hostnames that have no domain. |
338 What `ffap-machine-p' does with hostnames that have no domain." | 337 Value should be a symbol, one of `ping', `accept', and `reject'. |
339 :type '(choice (const ping) | 338 :type '(choice (const ping) |
340 (const accept) | 339 (const accept) |
341 (const reject)) | 340 (const reject)) |
342 :group 'ffap) | 341 :group 'ffap) |
343 (defcustom ffap-machine-p-known 'ping ; 'accept for speed | 342 (defcustom ffap-machine-p-known 'ping ; `accept' for higher speed |
344 "*A symbol, one of: ping, accept, reject. | 343 "*What `ffap-machine-p' does with hostnames that have a known domain. |
345 What `ffap-machine-p' does with hostnames that have a known domain | 344 Value should be a symbol, one of `ping', `accept', and `reject'. |
346 \(see mail-extr.el for the known domains\)." | 345 See `mail-extr.el' for the known domains." |
347 :type '(choice (const ping) | 346 :type '(choice (const ping) |
348 (const accept) | 347 (const accept) |
349 (const reject)) | 348 (const reject)) |
350 :group 'ffap) | 349 :group 'ffap) |
351 (defcustom ffap-machine-p-unknown 'reject | 350 (defcustom ffap-machine-p-unknown 'reject |
352 "*A symbol, one of: ping, accept, reject. | 351 "*What `ffap-machine-p' does with hostnames that have an unknown domain. |
353 What `ffap-machine-p' does with hostnames that have an unknown domain | 352 Value should be a symbol, one of `ping', `accept', and `reject'. |
354 \(see mail-extr.el for the known domains\)." | 353 See `mail-extr.el' for the known domains." |
355 :type '(choice (const ping) | 354 :type '(choice (const ping) |
356 (const accept) | 355 (const accept) |
357 (const reject)) | 356 (const reject)) |
358 :group 'ffap) | 357 :group 'ffap) |
359 | 358 |
449 (fset 'ffap-replace-path-component found) | 448 (fset 'ffap-replace-path-component found) |
450 (funcall found fullname name)))) | 449 (funcall found fullname name)))) |
451 ;; (ffap-replace-path-component "/who@foo.com:/whatever" "/new") | 450 ;; (ffap-replace-path-component "/who@foo.com:/whatever" "/new") |
452 | 451 |
453 (defun ffap-file-suffix (file) | 452 (defun ffap-file-suffix (file) |
454 "Return trailing \".foo\" suffix of FILE, or nil if none." | 453 "Return trailing `.foo' suffix of FILE, or nil if none." |
455 (let ((pos (string-match "\\.[^./]*\\'" file))) | 454 (let ((pos (string-match "\\.[^./]*\\'" file))) |
456 (and pos (substring file pos nil)))) | 455 (and pos (substring file pos nil)))) |
457 | 456 |
458 (defvar ffap-compression-suffixes '(".gz" ".Z") ; .z is mostly dead | 457 (defvar ffap-compression-suffixes '(".gz" ".Z") ; .z is mostly dead |
459 "List of suffixes tried by `ffap-file-exists-string'.") | 458 "List of suffixes tried by `ffap-file-exists-string'.") |
461 (defun ffap-file-exists-string (file &optional nomodify) | 460 (defun ffap-file-exists-string (file &optional nomodify) |
462 ;; Early jka-compr versions modified file-exists-p to return the | 461 ;; Early jka-compr versions modified file-exists-p to return the |
463 ;; filename, maybe modified by adding a suffix like ".gz". That | 462 ;; filename, maybe modified by adding a suffix like ".gz". That |
464 ;; broke the interface of file-exists-p, so it was later dropped. | 463 ;; broke the interface of file-exists-p, so it was later dropped. |
465 ;; Here we document and simulate the old behavior. | 464 ;; Here we document and simulate the old behavior. |
466 "Return FILE \(maybe modified\) if it exists, else nil. | 465 "Return FILE (maybe modified) if the file exists, else nil. |
467 When using jka-compr (a.k.a. `auto-compression-mode'), the returned | 466 When using jka-compr (a.k.a. `auto-compression-mode'), the returned |
468 name may have a suffix added from `ffap-compression-suffixes'. | 467 name may have a suffix added from `ffap-compression-suffixes'. |
469 The optional NOMODIFY argument suppresses the extra search." | 468 The optional NOMODIFY argument suppresses the extra search." |
470 (cond | 469 (cond |
471 ((not file) nil) ; quietly reject nil | 470 ((not file) nil) ; quietly reject nil |
481 (setq ret try list nil) | 480 (setq ret try list nil) |
482 (setq list (cdr list)))) | 481 (setq list (cdr list)))) |
483 ret)))) | 482 ret)))) |
484 | 483 |
485 (defun ffap-file-remote-p (filename) | 484 (defun ffap-file-remote-p (filename) |
486 "If FILENAME looks remote, return it \(maybe slightly improved\)." | 485 "If FILENAME looks remote, return it (maybe slightly improved)." |
487 ;; (ffap-file-remote-p "/user@foo.bar.com:/pub") | 486 ;; (ffap-file-remote-p "/user@foo.bar.com:/pub") |
488 ;; (ffap-file-remote-p "/cssun.mathcs.emory.edu://path") | 487 ;; (ffap-file-remote-p "/cssun.mathcs.emory.edu://path") |
489 ;; (ffap-file-remote-p "/ffap.el:80") | 488 ;; (ffap-file-remote-p "/ffap.el:80") |
490 (or (and ffap-ftp-regexp | 489 (or (and ffap-ftp-regexp |
491 (string-match ffap-ftp-regexp filename) | 490 (string-match ffap-ftp-regexp filename) |
933 (machine "-a-zA-Z0-9." "" ".") | 932 (machine "-a-zA-Z0-9." "" ".") |
934 ;; Mathematica paths: allow backquotes | 933 ;; Mathematica paths: allow backquotes |
935 (math-mode ",-:$+<>@-Z_a-z~`" "<" "@>;.,!?`:") | 934 (math-mode ",-:$+<>@-Z_a-z~`" "<" "@>;.,!?`:") |
936 ) | 935 ) |
937 "Alist of \(MODE CHARS BEG END\), where MODE is a symbol, | 936 "Alist of \(MODE CHARS BEG END\), where MODE is a symbol, |
938 possibly a `major-mode' or some symbol internal to ffap | 937 possibly a major-mode name, or one of the symbol |
939 \(such as 'file, 'url, 'machine, and 'nocolon\). | 938 `file', `url', `machine', and `nocolon'. |
940 `ffap-string-at-point' uses the data fields as follows: | 939 `ffap-string-at-point' uses the data fields as follows: |
941 1. find a maximal string of CHARS around point, | 940 1. find a maximal string of CHARS around point, |
942 2. strip BEG chars before point from the beginning, | 941 2. strip BEG chars before point from the beginning, |
943 3. Strip END chars after point from the end.") | 942 3. Strip END chars after point from the end.") |
944 | 943 |
946 ;; Added at suggestion of RHOGEE (for ff-paths), 7/24/95. | 945 ;; Added at suggestion of RHOGEE (for ff-paths), 7/24/95. |
947 "Last string returned by `ffap-string-at-point'.") | 946 "Last string returned by `ffap-string-at-point'.") |
948 | 947 |
949 (defun ffap-string-at-point (&optional mode) | 948 (defun ffap-string-at-point (&optional mode) |
950 "Return a string of characters from around point. | 949 "Return a string of characters from around point. |
951 MODE (defaults to `major-mode') is a symbol used to lookup string | 950 MODE (defaults to value of `major-mode') is a symbol used to look up string |
952 syntax parameters in `ffap-string-at-point-mode-alist'. | 951 syntax parameters in `ffap-string-at-point-mode-alist'. |
953 If MODE is not found, we fall back on the symbol 'file. | 952 If MODE is not found, we use `file' instead of MODE. |
954 Sets `ffap-string-at-point' and `ffap-string-at-point-region'." | 953 Sets `ffap-string-at-point' and `ffap-string-at-point-region'." |
955 (let* ((args | 954 (let* ((args |
956 (cdr | 955 (cdr |
957 (or (assq (or mode major-mode) ffap-string-at-point-mode-alist) | 956 (or (assq (or mode major-mode) ffap-string-at-point-mode-alist) |
958 (assq 'file ffap-string-at-point-mode-alist)))) | 957 (assq 'file ffap-string-at-point-mode-alist)))) |
1410 (defun ffap-menu-ask (title alist cont) | 1409 (defun ffap-menu-ask (title alist cont) |
1411 "Prompt from a menu of choices, and then apply some action. | 1410 "Prompt from a menu of choices, and then apply some action. |
1412 Arguments are TITLE, ALIST, and CONT \(a continuation function\). | 1411 Arguments are TITLE, ALIST, and CONT \(a continuation function\). |
1413 This uses either a menu or the minibuffer depending on invocation. | 1412 This uses either a menu or the minibuffer depending on invocation. |
1414 The TITLE string is used as either the prompt or menu title. | 1413 The TITLE string is used as either the prompt or menu title. |
1415 Each \(string . data\) ALIST entry defines a choice. | 1414 Each ALIST entry looks like (STRING . DATA) and defines one choice. |
1416 Function CONT is applied to the entry chosen by the user." | 1415 Function CONT is applied to the entry chosen by the user." |
1417 ;; Note: this function is used with a different continuation | 1416 ;; Note: this function is used with a different continuation |
1418 ;; by the ffap-url add-on package. | 1417 ;; by the ffap-url add-on package. |
1419 ;; Could try rewriting to use easymenu.el or lmenu.el. | 1418 ;; Could try rewriting to use easymenu.el or lmenu.el. |
1420 (let (choice) | 1419 (let (choice) |