aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-03-22 23:06:18 +0000
committerDave Love2000-03-22 23:06:18 +0000
commit01f975608a89cf8dcde99d6665fa5294190f8495 (patch)
treead1b9018b4e774b754a1add20bb70d28fd9221ea
parent52f326714d031845fedc6a9b5448228307e0f9c8 (diff)
downloademacs-01f975608a89cf8dcde99d6665fa5294190f8495.tar.gz
emacs-01f975608a89cf8dcde99d6665fa5294190f8495.zip
Restore previous use of browse-url-maybe-new-window.
-rw-r--r--lisp/net/browse-url.el44
1 files changed, 31 insertions, 13 deletions
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index 1cdfc1c1f86..1ed450100ab 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -494,6 +494,13 @@ negation if a prefix argument was given."
494 (not (eq (null browse-url-new-window-p) 494 (not (eq (null browse-url-new-window-p)
495 (null current-prefix-arg))))) 495 (null current-prefix-arg)))))
496 496
497;; interactive-p needs to be called at a function's top-level, hence
498;; the macro.
499(defmacro browse-url-maybe-new-window (arg)
500 `(if (interactive-p)
501 ,arg
502 browse-url-new-window-p))
503
497;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 504;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
498;; Browse current buffer 505;; Browse current buffer
499 506
@@ -599,6 +606,8 @@ narrowed."
599Prompts for a URL, defaulting to the URL at or before point. Variable 606Prompts for a URL, defaulting to the URL at or before point. Variable
600`browse-url-browser-function' says which browser to use." 607`browse-url-browser-function' says which browser to use."
601 (interactive (browse-url-interactive-arg "URL: ")) 608 (interactive (browse-url-interactive-arg "URL: "))
609 (unless (interactive-p)
610 (setq args (list browse-url-new-window-p)))
602 (if (functionp browse-url-browser-function) 611 (if (functionp browse-url-browser-function)
603 (apply browse-url-browser-function url args) 612 (apply browse-url-browser-function url args)
604 ;; The `function' can be an alist; look down it for first match 613 ;; The `function' can be an alist; look down it for first match
@@ -614,12 +623,15 @@ Prompts for a URL, defaulting to the URL at or before point. Variable
614 url)))) 623 url))))
615 624
616;;;###autoload 625;;;###autoload
617(defun browse-url-at-point () 626(defun browse-url-at-point (&optional arg)
618 "Ask a WWW browser to load the URL at or before point. 627 "Ask a WWW browser to load the URL at or before point.
619Doesn't let you edit the URL like `browse-url'. Variable 628Doesn't let you edit the URL like `browse-url'. Variable
620`browse-url-browser-function' says which browser to use." 629`browse-url-browser-function' says which browser to use."
621 (interactive) 630 (interactive "P")
622 (browse-url (browse-url-url-at-point))) 631 (browse-url (browse-url-url-at-point)
632 (if arg
633 (not browse-url-new-window-p)
634 browse-url-new-window-p)))
623 635
624(defun browse-url-event-buffer (event) 636(defun browse-url-event-buffer (event)
625 (window-buffer (posn-window (event-start event)))) 637 (window-buffer (posn-window (event-start event))))
@@ -706,7 +718,9 @@ used instead of `browse-url-new-window-p'."
706 (if new-window '("-noraise")) 718 (if new-window '("-noraise"))
707 (list "-remote" 719 (list "-remote"
708 (concat "openURL(" url 720 (concat "openURL(" url
709 (if new-window ",new-window") 721 (if (browse-url-maybe-new-window
722 new-window)
723 ",new-window")
710 ")")))))))) 724 ")"))))))))
711 (set-process-sentinel process 725 (set-process-sentinel process
712 (list 'lambda '(process change) 726 (list 'lambda '(process change)
@@ -771,7 +785,7 @@ used instead of `browse-url-new-window-p'."
771 (save-excursion 785 (save-excursion
772 (find-file (format "/tmp/Mosaic.%d" pid)) 786 (find-file (format "/tmp/Mosaic.%d" pid))
773 (erase-buffer) 787 (erase-buffer)
774 (insert (if new-window 788 (insert (if (browse-url-maybe-new-window new-window)
775 "newwin\n" 789 "newwin\n"
776 "goto\n") 790 "goto\n")
777 url "\n") 791 url "\n")
@@ -838,7 +852,7 @@ used instead of `browse-url-new-window-p'."
838 ;; Todo: start browser if fails 852 ;; Todo: start browser if fails
839 (process-send-string "browse-url" 853 (process-send-string "browse-url"
840 (concat "get url (" url ") output " 854 (concat "get url (" url ") output "
841 (if new-window 855 (if (browse-url-maybe-new-window new-window)
842 "new" 856 "new"
843 "current") 857 "current")
844 "\r\n")) 858 "\r\n"))
@@ -871,7 +885,7 @@ When called non-interactively, optional second argument NEW-WINDOW is
871used instead of `browse-url-new-window-p'." 885used instead of `browse-url-new-window-p'."
872 (interactive (browse-url-interactive-arg "W3 URL: ")) 886 (interactive (browse-url-interactive-arg "W3 URL: "))
873 (require 'w3) ; w3-fetch-other-window not autoloaded 887 (require 'w3) ; w3-fetch-other-window not autoloaded
874 (if new-window 888 (if (browse-url-maybe-new-window new-window)
875 (w3-fetch-other-window url) 889 (w3-fetch-other-window url)
876 (w3-fetch url))) 890 (w3-fetch url)))
877 891
@@ -884,7 +898,9 @@ The `browse-url-gnudoit-program' program is used with options given by
884 (interactive (browse-url-interactive-arg "W3 URL: ")) 898 (interactive (browse-url-interactive-arg "W3 URL: "))
885 (apply 'start-process (concat "gnudoit:" url) nil 899 (apply 'start-process (concat "gnudoit:" url) nil
886 browse-url-gnudoit-program 900 browse-url-gnudoit-program
887 (append browse-url-gnudoit-args (list (concat "(w3-fetch \"" url "\")") "(raise-frame)")))) 901 (append browse-url-gnudoit-args
902 (list (concat "(w3-fetch \"" url "\")")
903 "(raise-frame)"))))
888 904
889;; --- Lynx in an xterm --- 905;; --- Lynx in an xterm ---
890 906
@@ -897,7 +913,8 @@ in an Xterm window using the Xterm program named by `browse-url-xterm-program'
897with possible additional arguments `browse-url-xterm-args'." 913with possible additional arguments `browse-url-xterm-args'."
898 (interactive (browse-url-interactive-arg "Lynx URL: ")) 914 (interactive (browse-url-interactive-arg "Lynx URL: "))
899 (apply #'start-process `(,(concat "lynx" url) nil ,browse-url-xterm-program 915 (apply #'start-process `(,(concat "lynx" url) nil ,browse-url-xterm-program
900 ,@browse-url-xterm-args "-e" "lynx" ,url))) 916 ,@browse-url-xterm-args "-e" "lynx"
917 ,url)))
901 918
902;; --- Lynx in an Emacs "term" window --- 919;; --- Lynx in an Emacs "term" window ---
903 920
@@ -920,13 +937,13 @@ used instead of `browse-url-new-window-p'."
920 (buf (get-buffer "*lynx*")) 937 (buf (get-buffer "*lynx*"))
921 (proc (and buf (get-buffer-process buf))) 938 (proc (and buf (get-buffer-process buf)))
922 (n browse-url-lynx-input-attempts)) 939 (n browse-url-lynx-input-attempts))
923 (if (and new-buffer buf) 940 (if (and (browse-url-maybe-new-window new-buffer) buf)
924 ;; Rename away the OLD buffer. This isn't very polite, but 941 ;; Rename away the OLD buffer. This isn't very polite, but
925 ;; term insists on working in a buffer named *lynx* and would 942 ;; term insists on working in a buffer named *lynx* and would
926 ;; choke on *lynx*<1> 943 ;; choke on *lynx*<1>
927 (progn (set-buffer buf) 944 (progn (set-buffer buf)
928 (rename-uniquely))) 945 (rename-uniquely)))
929 (if (or new-buffer 946 (if (or (browse-url-maybe-new-window new-buffer)
930 (not buf) 947 (not buf)
931 (not proc) 948 (not proc)
932 (not (memq (process-status proc) '(run stop)))) 949 (not (memq (process-status proc) '(run stop))))
@@ -934,7 +951,8 @@ used instead of `browse-url-new-window-p'."
934 (progn 951 (progn
935 (setq buf 952 (setq buf
936 (apply #'make-term 953 (apply #'make-term
937 `("lynx" "lynx" nil ,@browse-url-lynx-emacs-args ,url))) 954 `("lynx" "lynx" nil ,@browse-url-lynx-emacs-args
955 ,url)))
938 (switch-to-buffer buf) 956 (switch-to-buffer buf)
939 (term-char-mode) 957 (term-char-mode)
940 (set-process-sentinel 958 (set-process-sentinel
@@ -1005,7 +1023,7 @@ used instead of `browse-url-new-window-p'."
1005 (let ((to (if (string-match "^mailto:" url) 1023 (let ((to (if (string-match "^mailto:" url)
1006 (substring url 7) 1024 (substring url 7)
1007 url))) 1025 url)))
1008 (if new-window 1026 (if (browse-url-maybe-new-window new-window)
1009 (compose-mail-other-window to nil nil nil 1027 (compose-mail-other-window to nil nil nil
1010 (list 'insert-buffer (current-buffer))) 1028 (list 'insert-buffer (current-buffer)))
1011 (compose-mail to nil nil nil nil 1029 (compose-mail to nil nil nil nil