comparison lisp/browse-url.el @ 16416:c7622616333c

(browse-url-at-point): Add autoload cookie. (browse-url-at-mouse, browse-url-of-buffer, browse-url-of-file) (browse-url-of-dired-file): Likewise.
author Richard M. Stallman <rms@gnu.org>
date Fri, 11 Oct 1996 02:34:27 +0000
parents e25afe6ea4d6
children 0bd213d55f05
comparison
equal deleted inserted replaced
16415:e25afe6ea4d6 16416:c7622616333c
97 97
98 ;; Can you write and test some code for the Macintrash and Windoze 98 ;; Can you write and test some code for the Macintrash and Windoze
99 ;; Netscape remote control APIs? (See the URL above). 99 ;; Netscape remote control APIs? (See the URL above).
100 100
101 ;; Do any other browsers have remote control? 101 ;; Do any other browsers have remote control?
102
103 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
104 ;; Installation
105
106 ;; Put the following in your ~/.emacs file:
107 ;;
108 ;; (autoload 'browse-url-at-point "browse-url"
109 ;; "Ask a WWW browser to load the URL at or before point." t)
110 ;; (autoload 'browse-url-at-mouse "browse-url"
111 ;; "Ask a WWW browser to load a URL clicked with the mouse." t)
112 ;; (autoload 'browse-url-of-buffer "browse-url"
113 ;; "Ask a WWW browser to display BUFFER." t)
114 ;; (autoload 'browse-url-of-file "browse-url"
115 ;; "Ask a WWW browser to display FILE." t)
116 ;; (autoload 'browse-url-of-dired-file "browse-url"
117 ;; "In Dired, ask a WWW browser to display the file named on this line." t)
118 102
119 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 103 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
120 ;; Usage 104 ;; Usage
121 105
122 ;; To display the URL at or before point: 106 ;; To display the URL at or before point:
428 (null current-prefix-arg))))) 412 (null current-prefix-arg)))))
429 413
430 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 414 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
431 ;; Browse current buffer 415 ;; Browse current buffer
432 416
417 ;;;###autoload
433 (defun browse-url-of-file (&optional file) 418 (defun browse-url-of-file (&optional file)
434 "Ask a WWW browser to display FILE. 419 "Ask a WWW browser to display FILE.
435 Display the current buffer's file if FILE is nil or if called 420 Display the current buffer's file if FILE is nil or if called
436 interactively. Turn the filename into a URL with function 421 interactively. Turn the filename into a URL with function
437 browse-url-file-url. Pass the URL to a browser using variable 422 browse-url-file-url. Pass the URL to a browser using variable
475 (setq file (concat "ftp://" 460 (setq file (concat "ftp://"
476 (substring file (match-beginning 2) (match-end 2)) 461 (substring file (match-beginning 2) (match-end 2))
477 "/" (substring file (match-end 0))))) 462 "/" (substring file (match-end 0)))))
478 file) 463 file)
479 464
465 ;;;###autoload
480 (defun browse-url-of-buffer (&optional buffer) 466 (defun browse-url-of-buffer (&optional buffer)
481 "Ask a WWW browser to display BUFFER. 467 "Ask a WWW browser to display BUFFER.
482 Display the current buffer if BUFFER is nil." 468 Display the current buffer if BUFFER is nil."
483 (interactive) 469 (interactive)
484 (save-excursion 470 (save-excursion
522 (cdr browse-url-temp-file-list)))) 508 (cdr browse-url-temp-file-list))))
523 509
524 (add-hook 'kill-buffer-hook 'browse-url-delete-temp-file) 510 (add-hook 'kill-buffer-hook 'browse-url-delete-temp-file)
525 (add-hook 'kill-emacs-hook 'browse-url-delete-temp-file-list) 511 (add-hook 'kill-emacs-hook 'browse-url-delete-temp-file-list)
526 512
513 ;;;###autoload
527 (defun browse-url-of-dired-file () 514 (defun browse-url-of-dired-file ()
528 "In Dired, ask a WWW browser to display the file named on this line." 515 "In Dired, ask a WWW browser to display the file named on this line."
529 (interactive) 516 (interactive)
530 (browse-url-of-file (dired-get-filename))) 517 (browse-url-of-file (dired-get-filename)))
531 518
539 Prompts for a URL, defaulting to the URL at or before point. Variable 526 Prompts for a URL, defaulting to the URL at or before point. Variable
540 `browse-url-browser-function' says which browser to use." 527 `browse-url-browser-function' says which browser to use."
541 (interactive (browse-url-interactive-arg "URL: ")) 528 (interactive (browse-url-interactive-arg "URL: "))
542 (apply browse-url-browser-function args)) 529 (apply browse-url-browser-function args))
543 530
531 ;;;###autoload
544 (defun browse-url-at-point () 532 (defun browse-url-at-point ()
545 "Ask a WWW browser to load the URL at or before point. 533 "Ask a WWW browser to load the URL at or before point.
546 Doesn't let you edit the URL like browse-url. Variable 534 Doesn't let you edit the URL like browse-url. Variable
547 `browse-url-browser-function' says which browser to use." 535 `browse-url-browser-function' says which browser to use."
548 (interactive) 536 (interactive)
558 (eval-and-compile 546 (eval-and-compile
559 (or (fboundp 'event-point) 547 (or (fboundp 'event-point)
560 (defun event-point (event) 548 (defun event-point (event)
561 (posn-point (event-start event))))) 549 (posn-point (event-start event)))))
562 550
551 ;;;###autoload
563 (defun browse-url-at-mouse (event) 552 (defun browse-url-at-mouse (event)
564 "Ask a WWW browser to load a URL clicked with the mouse. 553 "Ask a WWW browser to load a URL clicked with the mouse.
565 The URL is the one around or before the position of the mouse click 554 The URL is the one around or before the position of the mouse click
566 but point is not changed. Doesn't let you edit the URL like 555 but point is not changed. Doesn't let you edit the URL like
567 browse-url. Variable `browse-url-browser-function' says which browser 556 browse-url. Variable `browse-url-browser-function' says which browser