comparison lisp/browse-url.el @ 24126:8ebecccf46a6

(browse-url-maybe-new-window): Delete macro and its uses.
author Dave Love <fx@gnu.org>
date Tue, 19 Jan 1999 19:57:33 +0000
parents 2dde27ae5540
children c2b622202522
comparison
equal deleted inserted replaced
24125:5c8305dd352f 24126:8ebecccf46a6
489 (let ((event (elt (this-command-keys) 0))) 489 (let ((event (elt (this-command-keys) 0)))
490 (and (listp event) (mouse-set-point event))) 490 (and (listp event) (mouse-set-point event)))
491 (list (read-string prompt (browse-url-url-at-point)) 491 (list (read-string prompt (browse-url-url-at-point))
492 (not (eq (null browse-url-new-window-p) 492 (not (eq (null browse-url-new-window-p)
493 (null current-prefix-arg))))) 493 (null current-prefix-arg)))))
494
495 ;; interactive-p needs to be called at a function's top-level, hence
496 ;; the macro.
497 (defmacro browse-url-maybe-new-window (arg)
498 `(if (interactive-p)
499 'arg
500 browse-url-new-window-p))
501 494
502 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 495 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
503 ;; Browse current buffer 496 ;; Browse current buffer
504 497
505 ;;;###autoload 498 ;;;###autoload
715 (list url) 708 (list url)
716 (append 709 (append
717 (if new-window '("-noraise")) 710 (if new-window '("-noraise"))
718 (list "-remote" 711 (list "-remote"
719 (concat "openURL(" url 712 (concat "openURL(" url
720 (if (browse-url-maybe-new-window 713 (if new-window ",new-window")
721 new-window)
722 ",new-window")
723 ")")))))))) 714 ")"))))))))
724 (set-process-sentinel process 715 (set-process-sentinel process
725 (list 'lambda '(process change) 716 (list 'lambda '(process change)
726 (list 'browse-url-netscape-sentinel 'process url))))) 717 (list 'browse-url-netscape-sentinel 'process url)))))
727 718
755 746
756 ;; --- Mosaic --- 747 ;; --- Mosaic ---
757 748
758 ;;;###autoload 749 ;;;###autoload
759 (defun browse-url-mosaic (url &optional new-window) 750 (defun browse-url-mosaic (url &optional new-window)
760 ;; new-window ignored
761 "Ask the XMosaic WWW browser to load URL. 751 "Ask the XMosaic WWW browser to load URL.
762 752
763 Default to the URL around or before point. The strings in variable 753 Default to the URL around or before point. The strings in variable
764 `browse-url-mosaic-arguments' are also passed to Mosaic and the 754 `browse-url-mosaic-arguments' are also passed to Mosaic and the
765 program is invoked according to the variable 755 program is invoked according to the variable
783 (kill-buffer nil))) 773 (kill-buffer nil)))
784 (if (and pid (zerop (signal-process pid 0))) ; Mosaic running 774 (if (and pid (zerop (signal-process pid 0))) ; Mosaic running
785 (save-excursion 775 (save-excursion
786 (find-file (format "/tmp/Mosaic.%d" pid)) 776 (find-file (format "/tmp/Mosaic.%d" pid))
787 (erase-buffer) 777 (erase-buffer)
788 (insert (if (browse-url-maybe-new-window new-window) 778 (insert (if new-window
789 "newwin\n" 779 "newwin\n"
790 "goto\n") 780 "goto\n")
791 url "\n") 781 url "\n")
792 (save-buffer) 782 (save-buffer)
793 (kill-buffer nil) 783 (kill-buffer nil)
794 ;; Send signal SIGUSR to Mosaic 784 ;; Send signal SIGUSR to Mosaic
795 (message "Signalling Mosaic...") 785 (message "Signalling Mosaic...")
850 (open-network-stream "browse-url" " *browse-url*" 840 (open-network-stream "browse-url" " *browse-url*"
851 browse-url-CCI-host browse-url-CCI-port) 841 browse-url-CCI-host browse-url-CCI-port)
852 ;; Todo: start browser if fails 842 ;; Todo: start browser if fails
853 (process-send-string "browse-url" 843 (process-send-string "browse-url"
854 (concat "get url (" url ") output " 844 (concat "get url (" url ") output "
855 (if (browse-url-maybe-new-window new-window) 845 (if new-window
856 "new" 846 "new"
857 "current") 847 "current")
858 "\r\n")) 848 "\r\n"))
859 (process-send-string "browse-url" "disconnect\r\n") 849 (process-send-string "browse-url" "disconnect\r\n")
860 (delete-process "browse-url")) 850 (delete-process "browse-url"))
883 873
884 When called non-interactively, optional second argument NEW-WINDOW is 874 When called non-interactively, optional second argument NEW-WINDOW is
885 used instead of `browse-url-new-window-p'." 875 used instead of `browse-url-new-window-p'."
886 (interactive (browse-url-interactive-arg "W3 URL: ")) 876 (interactive (browse-url-interactive-arg "W3 URL: "))
887 (require 'w3) ; w3-fetch-other-window not autoloaded 877 (require 'w3) ; w3-fetch-other-window not autoloaded
888 (if (browse-url-maybe-new-window new-window) 878 (if new-window
889 (w3-fetch-other-window url) 879 (w3-fetch-other-window url)
890 (w3-fetch url))) 880 (w3-fetch url)))
891 881
892 ;;;###autoload 882 ;;;###autoload
893 (defun browse-url-w3-gnudoit (url &optional new-window) 883 (defun browse-url-w3-gnudoit (url &optional new-window)
932 (let* ((system-uses-terminfo t) ; Lynx uses terminfo 922 (let* ((system-uses-terminfo t) ; Lynx uses terminfo
933 ;; (term-term-name "vt100") ; ?? 923 ;; (term-term-name "vt100") ; ??
934 (buf (get-buffer "*lynx*")) 924 (buf (get-buffer "*lynx*"))
935 (proc (and buf (get-buffer-process buf))) 925 (proc (and buf (get-buffer-process buf)))
936 (n browse-url-lynx-input-attempts)) 926 (n browse-url-lynx-input-attempts))
937 (if (and (browse-url-maybe-new-window new-buffer) buf) 927 (if (and new-buffer buf)
938 ;; Rename away the OLD buffer. This isn't very polite, but 928 ;; Rename away the OLD buffer. This isn't very polite, but
939 ;; term insists on working in a buffer named *lynx* and would 929 ;; term insists on working in a buffer named *lynx* and would
940 ;; choke on *lynx*<1> 930 ;; choke on *lynx*<1>
941 (progn (set-buffer buf) 931 (progn (set-buffer buf)
942 (rename-uniquely))) 932 (rename-uniquely)))
943 (if (or (browse-url-maybe-new-window new-buffer) 933 (if (or new-buffer
944 (not buf) 934 (not buf)
945 (not proc) 935 (not proc)
946 (not (memq (process-status proc) '(run stop)))) 936 (not (memq (process-status proc) '(run stop))))
947 ;; start a new lynx 937 ;; start a new lynx
948 (progn 938 (progn
1017 (interactive (browse-url-interactive-arg "Mailto URL: ")) 1007 (interactive (browse-url-interactive-arg "Mailto URL: "))
1018 (save-excursion 1008 (save-excursion
1019 (let ((to (if (string-match "^mailto:" url) 1009 (let ((to (if (string-match "^mailto:" url)
1020 (substring url 7) 1010 (substring url 7)
1021 url))) 1011 url)))
1022 (if (browse-url-maybe-new-window new-window) 1012 (if new-window
1023 (compose-mail-other-window to nil nil nil 1013 (compose-mail-other-window to nil nil nil
1024 (list 'insert-buffer (current-buffer))) 1014 (list 'insert-buffer (current-buffer)))
1025 (compose-mail to nil nil nil nil 1015 (compose-mail to nil nil nil nil
1026 (list 'insert-buffer (current-buffer))))))) 1016 (list 'insert-buffer (current-buffer)))))))
1027 1017