comparison lisp/browse-url.el @ 20167:5bd2ed765d52

Doc fixes. (browse-url): Apply, don't just call, browse-url-choose-browser, so args works properly. (browse-url-maybe-new-window): New function. (browse-url-netscape, browse-url-mosaic, browse-url-cci, browse-url-w3, browse-url-lynx-emacs, browse-url-mail): Use it. (browse-url-lynx-emacs): Don't call term-term-name. (browse-url-lynx-input-field, browse-url-lynx-input-delay, browse-url-lynx-input-attempts): New variables. (browse-url-lynx-emacs): Use any existing Lynx buffer; take care to move off input fields. (After Vladimir Alexiev <vladimir@cs.ualberta.ca>.) (browse-url-mosaic-program): New variable. (browse-url-mosaic): Use browse-url-mosaic-program and browse-url-new-window-p. (browse-url-at-mouse): Use browse-url-new-window-p.
author Dave Love <fx@gnu.org>
date Thu, 23 Oct 1997 13:43:14 +0000
parents 14f83589db18
children dfd02d692b0c
comparison
equal deleted inserted replaced
20166:e26933e2b3e8 20167:5bd2ed765d52
38 ;; each supported browser. If the chosen browser is not running, it 38 ;; each supported browser. If the chosen browser is not running, it
39 ;; is started. Currently there is support for: 39 ;; is started. Currently there is support for:
40 40
41 ;; Function Browser Earliest version 41 ;; Function Browser Earliest version
42 ;; browse-url-netscape Netscape 1.1b1 42 ;; browse-url-netscape Netscape 1.1b1
43 ;; browse-url-mosaic XMosaic <= 2.4 43 ;; browse-url-mosaic XMosaic/mMosaic <= 2.4
44 ;; browse-url-cci XMosaic 2.5 44 ;; browse-url-cci XMosaic 2.5
45 ;; browse-url-w3 w3 0 45 ;; browse-url-w3 w3 0
46 ;; browse-url-w3-gnudoit w3 remotely 46 ;; browse-url-w3-gnudoit w3 remotely
47 ;; browse-url-iximosaic IXI Mosaic ? 47 ;; browse-url-iximosaic IXI Mosaic ?
48 ;; browse-url-lynx-* Lynx 0 48 ;; browse-url-lynx-* Lynx 0
94 ;; <URL:http://lynx.browser.org/>. 94 ;; <URL:http://lynx.browser.org/>.
95 95
96 ;; Free graphical browsers that could be used by `browse-url-generic' 96 ;; Free graphical browsers that could be used by `browse-url-generic'
97 ;; include Chimera <URL:ftp://ftp.cs.unlv.edu/pub/chimera> and 97 ;; include Chimera <URL:ftp://ftp.cs.unlv.edu/pub/chimera> and
98 ;; <URL:http://www.unlv.edu/chimera/>, Arena 98 ;; <URL:http://www.unlv.edu/chimera/>, Arena
99 ;; <URL:ftp://ftp.yggdrasil.com/pub/dist/web/arena>, Amaya 99 ;; <URL:ftp://ftp.yggdrasil.com/pub/dist/web/arena> and Amaya
100 ;; <URL:ftp://ftp.w3.org/pub/amaya>, mMosaic 100 ;; <URL:ftp://ftp.w3.org/pub/amaya>. mMosaic
101 ;; <URL:ftp://sig.enst.fr/pub/multicast/mMosaic/> (the latter with 101 ;; <URL:ftp://sig.enst.fr/pub/multicast/mMosaic/> (with development
102 ;; development support for Java applets). 102 ;; support for Java applets and multicast) can be used like Mosaic by
103 ;; setting `browse-url-mosaic-program' appropriately.
103 104
104 ;; I [Denis Howe] recommend Nelson Minar <nelson@santafe.edu>'s excellent 105 ;; I [Denis Howe] recommend Nelson Minar <nelson@santafe.edu>'s excellent
105 ;; html-helper-mode.el for editing HTML and thank Nelson for 106 ;; html-helper-mode.el for editing HTML and thank Nelson for
106 ;; his many useful comments on this code. 107 ;; his many useful comments on this code.
107 ;; <URL:http://www.santafe.edu/%7Enelson/hhm-beta/> 108 ;; <URL:http://www.santafe.edu/%7Enelson/hhm-beta/>
252 "*A list of strings to pass to Netscape as arguments." 253 "*A list of strings to pass to Netscape as arguments."
253 :type '(repeat (string :tag "Argument")) 254 :type '(repeat (string :tag "Argument"))
254 :group 'browse-url) 255 :group 'browse-url)
255 256
256 (defcustom browse-url-netscape-startup-arguments browse-url-netscape-arguments 257 (defcustom browse-url-netscape-startup-arguments browse-url-netscape-arguments
257 "*A list of strings to pass to Netscape when it starts up. 258 "*A list of strings to pass to Netscape when it start up.
258 Defaults to the value of `browse-url-netscape-arguments' at the time 259 Defaults to the value of `browse-url-netscape-arguments' at the time
259 `browse-url' is loaded." 260 `browse-url' is loaded."
260 :type '(repeat (string :tag "Argument")) 261 :type '(repeat (string :tag "Argument"))
261 :group 'browse-url) 262 :group 'browse-url)
262 263
263 (defcustom browse-url-new-window-p nil 264 (defcustom browse-url-new-window-p nil
264 "*If non-nil, always open a new browser window. 265 "*If non-nil, always open a new browser window.
265 Passing an interactive argument to \\[browse-url-netscape] or 266 Passing an interactive argument to \\[browse-url-netscape],
266 \\[browse-url-cci] reverses the effect of this variable. Requires 267 \\[browse-url-mosaic] or \\[browse-url-cci] reverses the effect of
267 Netscape version 1.1N or later or XMosaic version 2.5 or later." 268 this variable. Requires Netscape version 1.1N or later or XMosaic
269 version 2.5 or later."
268 :type 'boolean 270 :type 'boolean
269 :group 'browse-url) 271 :group 'browse-url)
270 272
271 (defcustom browse-url-netscape-display nil 273 (defcustom browse-url-netscape-display nil
272 "*The X display for running Netscape, if not same as Emacs's." 274 "*The X display for running Netscape, if not same as Emacs'."
273 :type '(choice string (const nil)) 275 :type '(choice string (const nil))
276 :group 'browse-url)
277
278 (defcustom browse-url-mosaic-program "xmosaic"
279 "*The name by which to invoke Mosaic (or mMosaic)."
280 :type 'string
274 :group 'browse-url) 281 :group 'browse-url)
275 282
276 (defcustom browse-url-mosaic-arguments nil 283 (defcustom browse-url-mosaic-arguments nil
277 "*A list of strings to pass to Mosaic as arguments." 284 "*A list of strings to pass to Mosaic as arguments."
278 :type '(repeat (string :tag "Argument")) 285 :type '(repeat (string :tag "Argument"))
318 (defvar browse-url-save-file nil 325 (defvar browse-url-save-file nil
319 "If non-nil, save the buffer before displaying its file. 326 "If non-nil, save the buffer before displaying its file.
320 Used by the `browse-url-of-file' command.") 327 Used by the `browse-url-of-file' command.")
321 328
322 (defvar browse-url-of-file-hook nil 329 (defvar browse-url-of-file-hook nil
323 "A hook to be run with run-hook after `browse-url-of-file' has asked 330 "Run after `browse-url-of-file' has asked a browser to load a file.
324 a browser to load a file.
325 331
326 Set this to `browse-url-netscape-reload' to force Netscape to load the 332 Set this to `browse-url-netscape-reload' to force Netscape to load the
327 file rather than displaying a cached copy.") 333 file rather than displaying a cached copy.")
328 334
329 (defvar browse-url-usr1-signal 335 (defvar browse-url-usr1-signal
381 :type '(repeat (string :tag "Argument")) 387 :type '(repeat (string :tag "Argument"))
382 :group 'browse-url) 388 :group 'browse-url)
383 389
384 (defcustom browse-url-temp-dir 390 (defcustom browse-url-temp-dir
385 (or (getenv "TMPDIR") "/tmp") 391 (or (getenv "TMPDIR") "/tmp")
386 "*The name of a directory in which to store temporary files 392 "*The name of a directory for browse-url's temporary files.
387 generated by functions like `browse-url-of-region'. You might want to 393 Such files are generated by functions like `browse-url-of-region'.
388 set this to somewhere with restricted read permissions for privacy's sake." 394 You might want to set this to somewhere with restricted read permissions
395 for privacy's sake."
389 :type 'string 396 :type 'string
390 :group 'browse-url) 397 :group 'browse-url)
391 398
392 (defcustom browse-url-netscape-version 399 (defcustom browse-url-netscape-version
393 3 400 3
394 "*The version of Netscape you are using. 401 "*The version of Netscape you are using.
395 This affects how URL reloading is done; the mechanism changed 402 This affects how URL reloading is done; the mechanism changed
396 incompatibly at version 4." 403 incompatibly at version 4."
397 :type 'number 404 :type 'number
398 :group 'browse-url) 405 :group 'browse-url)
406
407 (defvar browse-url-lynx-input-field 'avoid
408 "*Action on selecting an existing Lynx buffer at an input field.
409 What to do when sending a new URL to an existing Lynx buffer in Emacs
410 if the Lynx cursor is on an input field (in which case the `g' command
411 would be entered as data). Such fields are recognized by the
412 underlines ____. Allowed values: nil: disregard it, 'warn: warn the
413 user and don't emit the URL, 'avoid: try to avoid the field by moving
414 down (this *won't* always work).")
415
416 (defvar browse-url-lynx-input-attempts 10
417 "*How many times to try to move down from a series of lynx input fields.")
418
419 (defvar browse-url-lynx-input-delay 0.2
420 "*How many seconds to wait for lynx between moves down from an input field.")
399 421
400 (defvar browse-url-temp-file-list '()) 422 (defvar browse-url-temp-file-list '())
401 423
402 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 424 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
403 ;; URL input 425 ;; URL input
420 (let ((event (elt (this-command-keys) 0))) 442 (let ((event (elt (this-command-keys) 0)))
421 (and (listp event) (mouse-set-point event))) 443 (and (listp event) (mouse-set-point event)))
422 (list (read-string prompt (browse-url-url-at-point)) 444 (list (read-string prompt (browse-url-url-at-point))
423 (not (eq (null browse-url-new-window-p) 445 (not (eq (null browse-url-new-window-p)
424 (null current-prefix-arg))))) 446 (null current-prefix-arg)))))
447
448 (defun browse-url-maybe-new-window (arg)
449 (if (interactive-p)
450 arg
451 browse-url-new-window-p))
425 452
426 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 453 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
427 ;; Browse current buffer 454 ;; Browse current buffer
428 455
429 ;;;###autoload 456 ;;;###autoload
548 "Ask a WWW browser to load URL. 575 "Ask a WWW browser to load URL.
549 Prompts for a URL, defaulting to the URL at or before point. Variable 576 Prompts for a URL, defaulting to the URL at or before point. Variable
550 `browse-url-browser-function' says which browser to use." 577 `browse-url-browser-function' says which browser to use."
551 (interactive (browse-url-interactive-arg "URL: ")) 578 (interactive (browse-url-interactive-arg "URL: "))
552 (if (consp browse-url-browser-function) 579 (if (consp browse-url-browser-function)
553 (browse-url-choose-browser args) 580 (apply browse-url-choose-browser args)
554 (apply browse-url-browser-function args))) 581 (apply browse-url-browser-function args)))
555 582
556 (defun browse-url-choose-browser (url &rest args) 583 (defun browse-url-choose-browser (url &rest args)
557 "Pass URL to a browser function chosen. 584 "Pass URL to a browser function chosen.
558 This is done according to the association list in variable 585 This is done according to the association list in variable
569 (error "No browser in browse-url-browser-function matching URL %s" url)))) 596 (error "No browser in browse-url-browser-function matching URL %s" url))))
570 597
571 ;;;###autoload 598 ;;;###autoload
572 (defun browse-url-at-point () 599 (defun browse-url-at-point ()
573 "Ask a WWW browser to load the URL at or before point. 600 "Ask a WWW browser to load the URL at or before point.
574 Doesn't let you edit the URL like browse-url. Variable 601 Doesn't let you edit the URL like `browse-url'. Variable
575 `browse-url-browser-function' says which browser to use." 602 `browse-url-browser-function' says which browser to use."
576 (interactive) 603 (interactive)
577 (browse-url (browse-url-url-at-point))) 604 (browse-url (browse-url-url-at-point)))
578 605
579 (defun browse-url-event-buffer (event) 606 (defun browse-url-event-buffer (event)
585 ;;;###autoload 612 ;;;###autoload
586 (defun browse-url-at-mouse (event) 613 (defun browse-url-at-mouse (event)
587 "Ask a WWW browser to load a URL clicked with the mouse. 614 "Ask a WWW browser to load a URL clicked with the mouse.
588 The URL is the one around or before the position of the mouse click 615 The URL is the one around or before the position of the mouse click
589 but point is not changed. Doesn't let you edit the URL like 616 but point is not changed. Doesn't let you edit the URL like
590 browse-url. Variable `browse-url-browser-function' says which browser 617 `browse-url'. Variable `browse-url-browser-function' says which browser
591 to use." 618 to use."
592 (interactive "e") 619 (interactive "e")
593 (save-excursion 620 (save-excursion
594 (set-buffer (browse-url-event-buffer event)) 621 (set-buffer (browse-url-event-buffer event))
595 (goto-char (browse-url-event-point event)) 622 (goto-char (browse-url-event-point event))
596 (let ((url (browse-url-url-at-point))) 623 (let ((url (browse-url-url-at-point)))
597 (if (string-equal url "") 624 (if (string-equal url "")
598 (error "No URL found")) 625 (error "No URL found"))
599 (browse-url url)))) 626 (browse-url url browse-url-new-window-p))))
600 627
601 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 628 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
602 ;; Browser-specific commands 629 ;; Browser-specific commands
603 630
604 ;; --- Netscape --- 631 ;; --- Netscape ---
613 (cons (concat "DISPLAY=" display) process-environment) 640 (cons (concat "DISPLAY=" display) process-environment)
614 process-environment))) 641 process-environment)))
615 642
616 (defun browse-url-emacs-display () 643 (defun browse-url-emacs-display ()
617 "Return the X display Emacs is running on. 644 "Return the X display Emacs is running on.
618 This nil if the display is the same as the DISPLAY environment variable. 645 This is nil if the display is the same as the DISPLAY environment variable.
619 646
620 Actually Emacs could be using several screens on several displays, as 647 Actually Emacs could be using several screens on several displays, as
621 listed by (emacs-display-list) and (x-display-screens DISPLAY), this 648 listed by (emacs-display-list) and (x-display-screens DISPLAY), this
622 just returns the display showing the selected frame. You got a 649 just returns the display showing the selected frame. You got a
623 problem with that?" 650 problem with that?"
655 (if (eq window-system 'w32) 682 (if (eq window-system 'w32)
656 (list url) 683 (list url)
657 (if new-window '("-noraise")) 684 (if new-window '("-noraise"))
658 (list "-remote" 685 (list "-remote"
659 (concat "openURL(" url 686 (concat "openURL(" url
660 (if new-window ",new-window") 687 (if (browse-url-maybe-new-window
688 new-window)
689 ",new-window")
661 ")"))))))) 690 ")")))))))
662 (set-process-sentinel process 691 (set-process-sentinel process
663 (list 'lambda '(process change) 692 (list 'lambda '(process change)
664 (list 'browse-url-netscape-sentinel 'process url))))) 693 (list 'browse-url-netscape-sentinel 'process url)))))
665 694
672 (apply 'start-process (concat "netscape" url) nil 701 (apply 'start-process (concat "netscape" url) nil
673 browse-url-netscape-program 702 browse-url-netscape-program
674 (append browse-url-netscape-startup-arguments (list url)))))) 703 (append browse-url-netscape-startup-arguments (list url))))))
675 704
676 (defun browse-url-netscape-reload () 705 (defun browse-url-netscape-reload ()
677 "Ask Netscape to reload its current document." 706 "Ask Netscape to reload its current document.
707 How depends on `browse-url-netscape-version'."
678 (interactive) 708 (interactive)
679 ;; Backwards incompatibility reported by 709 ;; Backwards incompatibility reported by
680 ;; <peter.kruse@psychologie.uni-regensburg.de>. 710 ;; <peter.kruse@psychologie.uni-regensburg.de>.
681 (browse-url-netscape-send (if (>= browse-url-netscape-version 4) 711 (browse-url-netscape-send (if (>= browse-url-netscape-version 4)
682 "xfeDoCommand(reload)" 712 "xfeDoCommand(reload)"
694 724
695 ;;;###autoload 725 ;;;###autoload
696 (defun browse-url-mosaic (url &optional new-window) 726 (defun browse-url-mosaic (url &optional new-window)
697 ;; new-window ignored 727 ;; new-window ignored
698 "Ask the XMosaic WWW browser to load URL. 728 "Ask the XMosaic WWW browser to load URL.
699 Default to the URL around or before point." 729
730 Default to the URL around or before point. The strings in variable
731 `browse-url-mosaic-arguments' are also passed to Mosaic and the
732 program is invoked according to the variable
733 `browse-url-mosaic-program'.
734
735 When called interactively, if variable `browse-url-new-window-p' is
736 non-nil, load the document in a new Mosaic window, otherwise use a
737 random existing one. A non-nil interactive prefix argument reverses
738 the effect of `browse-url-new-window-p'.
739
740 When called non-interactively, optional second argument NEW-WINDOW is
741 used instead of `browse-url-new-window-p'."
700 (interactive (browse-url-interactive-arg "Mosaic URL: ")) 742 (interactive (browse-url-interactive-arg "Mosaic URL: "))
701 (let ((pidfile (expand-file-name "~/.mosaicpid")) 743 (let ((pidfile (expand-file-name "~/.mosaicpid"))
702 pid pidbuf) 744 pid pidbuf)
703 (if (file-readable-p pidfile) 745 (if (file-readable-p pidfile)
704 (save-excursion 746 (save-excursion
708 (kill-buffer nil))) 750 (kill-buffer nil)))
709 (if (and pid (zerop (signal-process pid 0))) ; Mosaic running 751 (if (and pid (zerop (signal-process pid 0))) ; Mosaic running
710 (save-excursion 752 (save-excursion
711 (find-file (format "/tmp/Mosaic.%d" pid)) 753 (find-file (format "/tmp/Mosaic.%d" pid))
712 (erase-buffer) 754 (erase-buffer)
713 (insert "goto\n" url "\n") 755 (insert (if (browse-url-maybe-new-window new-window)
756 "newwin\n"
757 "goto\n")
758 url "\n")
714 (save-buffer) 759 (save-buffer)
715 (kill-buffer nil) 760 (kill-buffer nil)
716 ;; Send signal SIGUSR to Mosaic 761 ;; Send signal SIGUSR to Mosaic
717 (message "Signalling Mosaic...") 762 (message "Signalling Mosaic...")
718 (signal-process pid browse-url-usr1-signal) 763 (signal-process pid browse-url-usr1-signal)
720 ;; (call-process "kill" nil 0 nil "-USR1" (int-to-string pid)) 765 ;; (call-process "kill" nil 0 nil "-USR1" (int-to-string pid))
721 (message "Signalling Mosaic...done") 766 (message "Signalling Mosaic...done")
722 ) 767 )
723 ;; Mosaic not running - start it 768 ;; Mosaic not running - start it
724 (message "Starting Mosaic...") 769 (message "Starting Mosaic...")
725 (apply 'start-process "xmosaic" nil "xmosaic" 770 (apply 'start-process "xmosaic" nil browse-url-mosaic-program
726 (append browse-url-mosaic-arguments (list url))) 771 (append browse-url-mosaic-arguments (list url)))
727 (message "Starting Mosaic...done")))) 772 (message "Starting Mosaic...done"))))
728 773
729 ;; --- Grail --- 774 ;; --- Grail ---
730 775
769 (open-network-stream "browse-url" " *browse-url*" 814 (open-network-stream "browse-url" " *browse-url*"
770 browse-url-CCI-host browse-url-CCI-port) 815 browse-url-CCI-host browse-url-CCI-port)
771 ;; Todo: start browser if fails 816 ;; Todo: start browser if fails
772 (process-send-string "browse-url" 817 (process-send-string "browse-url"
773 (concat "get url (" url ") output " 818 (concat "get url (" url ") output "
774 (if new-window "new" "current") "\r\n")) 819 (if (browse-url-maybe-new-window
820 new-window)
821 "new"
822 "current")
823 "\r\n"))
775 (process-send-string "browse-url" "disconnect\r\n") 824 (process-send-string "browse-url" "disconnect\r\n")
776 (delete-process "browse-url")) 825 (delete-process "browse-url"))
777 826
778 ;; --- IXI Mosaic --- 827 ;; --- IXI Mosaic ---
779 828
792 (defun browse-url-w3 (url &optional new-window) 841 (defun browse-url-w3 (url &optional new-window)
793 ;; new-window ignored 842 ;; new-window ignored
794 "Ask the w3 WWW browser to load URL. 843 "Ask the w3 WWW browser to load URL.
795 Default to the URL around or before point." 844 Default to the URL around or before point."
796 (interactive (browse-url-interactive-arg "W3 URL: ")) 845 (interactive (browse-url-interactive-arg "W3 URL: "))
797 (w3-fetch url)) 846 (if (browse-url-maybe-new-window new-window)
847 (w3-fetch-other-window)
848 (w3-fetch url)))
798 849
799 ;;;###autoload 850 ;;;###autoload
800 (defun browse-url-w3-gnudoit (url &optional new-window) 851 (defun browse-url-w3-gnudoit (url &optional new-window)
801 ;; new-window ignored 852 ;; new-window ignored
802 "Ask another Emacs running gnuserv to load the URL using the W3 browser. 853 "Ask another Emacs running gnuserv to load the URL using the W3 browser.
821 (append browse-url-xterm-args (list "-e" "lynx" url)))) 872 (append browse-url-xterm-args (list "-e" "lynx" url))))
822 873
823 ;; --- Lynx in an Emacs "term" window --- 874 ;; --- Lynx in an Emacs "term" window ---
824 875
825 ;;;###autoload 876 ;;;###autoload
826 (defun browse-url-lynx-emacs (url &optional new-window) 877 (defun browse-url-lynx-emacs (url &optional new-buffer)
827 ;; new-window ignored
828 "Ask the Lynx WWW browser to load URL. 878 "Ask the Lynx WWW browser to load URL.
829 Default to the URL around or before point. Run a new Lynx process in 879 Default to the URL around or before point. With a prefix argument, run
830 an Emacs buffer." 880 a new Lynx process in a new buffer."
831 (interactive (browse-url-interactive-arg "Lynx URL: ")) 881 (interactive (browse-url-interactive-arg "Lynx URL: "))
832 (let ((system-uses-terminfo t)) ; Lynx uses terminfo 882 (let* ((system-uses-terminfo t) ; Lynx uses terminfo
833 (if (fboundp 'make-term) 883 ;; (term-term-name "vt100") ; ??
834 (let ((term-term-name "vt100")) 884 (buf (get-buffer "*lynx*"))
835 (set-buffer (make-term "browse-url" "lynx" nil url)) 885 (proc (and buf (get-buffer-process buf)))
836 (term-mode) 886 (n browse-url-lynx-input-attempts))
837 (term-char-mode) 887 (if (and (browse-url-maybe-new-window new-buffer) buf)
838 (switch-to-buffer "*browse-url*")) 888 ;; Rename away the OLD buffer. This isn't very polite, but
839 (terminal-emulator "*browse-url*" "lynx" (list url))))) 889 ;; term insists on working in a buffer named *lynx* and would
890 ;; choke on *lynx*<1>
891 (progn (set-buffer buf)
892 (rename-uniquely)))
893 (if (or (browse-url-maybe-new-window new-buffer)
894 (not buf)
895 (not proc)
896 (not (memq (process-status proc) '(run stop))))
897 ;; start a new lynx
898 (progn (switch-to-buffer (make-term "lynx" "lynx" nil url))
899 (term-char-mode))
900 ;; send the url to lynx in the old buffer
901 (let ((win (get-buffer-window buf t)))
902 (if win
903 (select-window win)
904 (switch-to-buffer buf)))
905 (if (eq (following-char) ?_)
906 (cond ((eq browse-url-lynx-input-field 'warn)
907 (error "Please move out of the input field first."))
908 ((eq browse-url-lynx-input-field 'avoid)
909 (while (and (eq (following-char) ?_) (> n 0))
910 (term-send-down) ; down arrow
911 (sit-for browse-url-lynx-input-delay))
912 (if (eq (following-char) ?_)
913 (error "Cannot move out of the input field, sorry.")))))
914 (term-send-string proc (concat "g" ; goto
915 "\C-u" ; kill default url
916 url
917 "\r")))))
840 918
841 ;; --- MMM --- 919 ;; --- MMM ---
842 920
843 ;;;###autoload 921 ;;;###autoload
844 (defun browse-url-mmm (url &optional new-window) 922 (defun browse-url-mmm (url &optional new-window)
866 recipient's address. Supplying a non-nil interactive prefix argument 944 recipient's address. Supplying a non-nil interactive prefix argument
867 will cause the mail to be composed in another window rather than the 945 will cause the mail to be composed in another window rather than the
868 current one." 946 current one."
869 (interactive (browse-url-interactive-arg "Mailto URL: ")) 947 (interactive (browse-url-interactive-arg "Mailto URL: "))
870 (save-excursion 948 (save-excursion
871 (let ((func (if new-window 949 (let ((func (if (browse-url-maybe-new-window new-window)
872 'compose-mail-other-window 950 'compose-mail-other-window
873 'compose-mail)) 951 'compose-mail))
874 (to (if (string-match "^mailto:" url) 952 (to (if (string-match "^mailto:" url)
875 (substring url 7) 953 (substring url 7)
876 url))) 954 url)))