aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTassilo Horn2020-05-10 20:41:42 +0200
committerTassilo Horn2020-05-10 20:41:42 +0200
commit5a31b1afca41e71f15a56ad834449bf49ca6aad2 (patch)
tree151d5c82e68df2de203aa2e7e8262f8f8dae00c5
parent0bb9aeddd6ac713c751b3b6586d62d2dcc8465c0 (diff)
downloademacs-5a31b1afca41e71f15a56ad834449bf49ca6aad2.tar.gz
emacs-5a31b1afca41e71f15a56ad834449bf49ca6aad2.zip
Prefer function-put over put for setting browse-url-browser-kind.
* lisp/net/browse-url.el: Prefer `function-put' over `put' for setting `browse-url-browser-kind' symbol property.
-rw-r--r--lisp/net/browse-url.el79
1 files changed, 41 insertions, 38 deletions
diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el
index f88de98fca7..8132f8d9933 100644
--- a/lisp/net/browse-url.el
+++ b/lisp/net/browse-url.el
@@ -127,8 +127,10 @@
127;; is not sensible to invoke an external browser with it, so here only 127;; is not sensible to invoke an external browser with it, so here only
128;; internal browsers are considered. Therefore, it is advised to put 128;; internal browsers are considered. Therefore, it is advised to put
129;; that property also on custom browser functions. 129;; that property also on custom browser functions.
130;; (put 'my-browse-url-in-emacs 'browse-url-browser-kind 'internal) 130;; (function-put 'my-browse-url-in-emacs 'browse-url-browser-kind
131;; (put 'my-browse-url-externally 'browse-url-browser-kind 'external) 131;; 'internal)
132;; (function-put 'my-browse-url-externally 'browse-url-browser-kind
133;; 'external)
132 134
133;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 135;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
134;;; Code: 136;;; Code:
@@ -621,8 +623,8 @@ process), or nil (we don't know)."
621 623
622(defun browse-url--browser-kind-mailto (url) 624(defun browse-url--browser-kind-mailto (url)
623 (browse-url--browser-kind browse-url-mailto-function url)) 625 (browse-url--browser-kind browse-url-mailto-function url))
624(put 'browse-url--mailto 'browse-url-browser-kind 626(function-put 'browse-url--mailto 'browse-url-browser-kind
625 #'browse-url--browser-kind-mailto) 627 #'browse-url--browser-kind-mailto)
626 628
627(defun browse-url--man (url &rest args) 629(defun browse-url--man (url &rest args)
628 "Calls `browse-url-man-function' with URL and ARGS." 630 "Calls `browse-url-man-function' with URL and ARGS."
@@ -630,8 +632,8 @@ process), or nil (we don't know)."
630 632
631(defun browse-url--browser-kind-man (url) 633(defun browse-url--browser-kind-man (url)
632 (browse-url--browser-kind browse-url-man-function url)) 634 (browse-url--browser-kind browse-url-man-function url))
633(put 'browse-url--man 'browse-url-browser-kind 635(function-put 'browse-url--man 'browse-url-browser-kind
634 #'browse-url--browser-kind-man) 636 #'browse-url--browser-kind-man)
635 637
636(defun browse-url--browser (url &rest args) 638(defun browse-url--browser (url &rest args)
637 "Calls `browse-url-browser-function' with URL and ARGS." 639 "Calls `browse-url-browser-function' with URL and ARGS."
@@ -639,8 +641,8 @@ process), or nil (we don't know)."
639 641
640(defun browse-url--browser-kind-browser (url) 642(defun browse-url--browser-kind-browser (url)
641 (browse-url--browser-kind browse-url-browser-function url)) 643 (browse-url--browser-kind browse-url-browser-function url))
642(put 'browse-url--browser 'browse-url-browser-kind 644(function-put 'browse-url--browser 'browse-url-browser-kind
643 #'browse-url--browser-kind-browser) 645 #'browse-url--browser-kind-browser)
644 646
645(defun browse-url--non-html-file-url-p (url) 647(defun browse-url--non-html-file-url-p (url)
646 "Return non-nil if URL is a file:// URL of a non-HTML file." 648 "Return non-nil if URL is a file:// URL of a non-HTML file."
@@ -1010,8 +1012,8 @@ The optional NEW-WINDOW argument is not used."
1010 (url-unhex-string url) 1012 (url-unhex-string url)
1011 url))))) 1013 url)))))
1012 1014
1013(put 'browse-url-default-windows-browser 'browse-url-browser-kind 1015(function-put 'browse-url-default-windows-browser 'browse-url-browser-kind
1014 'external) 1016 'external)
1015 1017
1016(defun browse-url-default-macosx-browser (url &optional _new-window) 1018(defun browse-url-default-macosx-browser (url &optional _new-window)
1017 "Invoke the macOS system's default Web browser. 1019 "Invoke the macOS system's default Web browser.
@@ -1019,8 +1021,8 @@ The optional NEW-WINDOW argument is not used."
1019 (interactive (browse-url-interactive-arg "URL: ")) 1021 (interactive (browse-url-interactive-arg "URL: "))
1020 (start-process (concat "open " url) nil "open" url)) 1022 (start-process (concat "open " url) nil "open" url))
1021 1023
1022(put 'browse-url-default-macosx-browser 'browse-url-browser-kind 1024(function-put 'browse-url-default-macosx-browser 'browse-url-browser-kind
1023 'external) 1025 'external)
1024 1026
1025;; --- Netscape --- 1027;; --- Netscape ---
1026 1028
@@ -1078,9 +1080,9 @@ instead of `browse-url-new-window-flag'."
1078 (lambda (&rest _ignore) (error "No usable browser found")))) 1080 (lambda (&rest _ignore) (error "No usable browser found"))))
1079 url args)) 1081 url args))
1080 1082
1081(put 'browse-url-default-browser 'browse-url-browser-kind 1083(function-put 'browse-url-default-browser 'browse-url-browser-kind
1082 ;; Well, most probably external if we ignore w3. 1084 ;; Well, most probably external if we ignore w3.
1083 'external) 1085 'external)
1084 1086
1085(defun browse-url-can-use-xdg-open () 1087(defun browse-url-can-use-xdg-open ()
1086 "Return non-nil if the \"xdg-open\" program can be used. 1088 "Return non-nil if the \"xdg-open\" program can be used.
@@ -1101,7 +1103,7 @@ The optional argument IGNORED is not used."
1101 (interactive (browse-url-interactive-arg "URL: ")) 1103 (interactive (browse-url-interactive-arg "URL: "))
1102 (call-process "xdg-open" nil 0 nil url)) 1104 (call-process "xdg-open" nil 0 nil url))
1103 1105
1104(put 'browse-url-xdg-open 'browse-url-browser-kind 'external) 1106(function-put 'browse-url-xdg-open 'browse-url-browser-kind 'external)
1105 1107
1106;;;###autoload 1108;;;###autoload
1107(defun browse-url-netscape (url &optional new-window) 1109(defun browse-url-netscape (url &optional new-window)
@@ -1146,7 +1148,7 @@ used instead of `browse-url-new-window-flag'."
1146 `(lambda (process change) 1148 `(lambda (process change)
1147 (browse-url-netscape-sentinel process ,url))))) 1149 (browse-url-netscape-sentinel process ,url)))))
1148 1150
1149(put 'browse-url-netscape 'browse-url-browser-kind 'external) 1151(function-put 'browse-url-netscape 'browse-url-browser-kind 'external)
1150 1152
1151(defun browse-url-netscape-sentinel (process url) 1153(defun browse-url-netscape-sentinel (process url)
1152 "Handle a change to the process communicating with Netscape." 1154 "Handle a change to the process communicating with Netscape."
@@ -1218,7 +1220,7 @@ used instead of `browse-url-new-window-flag'."
1218 `(lambda (process change) 1220 `(lambda (process change)
1219 (browse-url-mozilla-sentinel process ,url))))) 1221 (browse-url-mozilla-sentinel process ,url)))))
1220 1222
1221(put 'browse-url-mozilla 'browse-url-browser-kind 'external) 1223(function-put 'browse-url-mozilla 'browse-url-browser-kind 'external)
1222 1224
1223(defun browse-url-mozilla-sentinel (process url) 1225(defun browse-url-mozilla-sentinel (process url)
1224 "Handle a change to the process communicating with Mozilla." 1226 "Handle a change to the process communicating with Mozilla."
@@ -1260,7 +1262,7 @@ instead of `browse-url-new-window-flag'."
1260 '("-new-window"))) 1262 '("-new-window")))
1261 (list url))))) 1263 (list url)))))
1262 1264
1263(put 'browse-url-firefox 'browse-url-browser-kind 'external) 1265(function-put 'browse-url-firefox 'browse-url-browser-kind 'external)
1264 1266
1265;;;###autoload 1267;;;###autoload
1266(defun browse-url-chromium (url &optional _new-window) 1268(defun browse-url-chromium (url &optional _new-window)
@@ -1279,7 +1281,7 @@ The optional argument NEW-WINDOW is not used."
1279 browse-url-chromium-arguments 1281 browse-url-chromium-arguments
1280 (list url))))) 1282 (list url)))))
1281 1283
1282(put 'browse-url-chromium 'browse-url-browser-kind 'external) 1284(function-put 'browse-url-chromium 'browse-url-browser-kind 'external)
1283 1285
1284(defun browse-url-chrome (url &optional _new-window) 1286(defun browse-url-chrome (url &optional _new-window)
1285 "Ask the Google Chrome WWW browser to load URL. 1287 "Ask the Google Chrome WWW browser to load URL.
@@ -1297,7 +1299,7 @@ The optional argument NEW-WINDOW is not used."
1297 browse-url-chrome-arguments 1299 browse-url-chrome-arguments
1298 (list url))))) 1300 (list url)))))
1299 1301
1300(put 'browse-url-chrome 'browse-url-browser-kind 'external) 1302(function-put 'browse-url-chrome 'browse-url-browser-kind 'external)
1301 1303
1302;;;###autoload 1304;;;###autoload
1303(defun browse-url-galeon (url &optional new-window) 1305(defun browse-url-galeon (url &optional new-window)
@@ -1336,7 +1338,7 @@ used instead of `browse-url-new-window-flag'."
1336 `(lambda (process change) 1338 `(lambda (process change)
1337 (browse-url-galeon-sentinel process ,url))))) 1339 (browse-url-galeon-sentinel process ,url)))))
1338 1340
1339(put 'browse-url-galeon 'browse-url-browser-kind 'external) 1341(function-put 'browse-url-galeon 'browse-url-browser-kind 'external)
1340 1342
1341(defun browse-url-galeon-sentinel (process url) 1343(defun browse-url-galeon-sentinel (process url)
1342 "Handle a change to the process communicating with Galeon." 1344 "Handle a change to the process communicating with Galeon."
@@ -1384,7 +1386,7 @@ used instead of `browse-url-new-window-flag'."
1384 `(lambda (process change) 1386 `(lambda (process change)
1385 (browse-url-epiphany-sentinel process ,url))))) 1387 (browse-url-epiphany-sentinel process ,url)))))
1386 1388
1387(put 'browse-url-epiphany 'browse-url-browser-kind 'external) 1389(function-put 'browse-url-epiphany 'browse-url-browser-kind 'external)
1388 1390
1389(defun browse-url-epiphany-sentinel (process url) 1391(defun browse-url-epiphany-sentinel (process url)
1390 "Handle a change to the process communicating with Epiphany." 1392 "Handle a change to the process communicating with Epiphany."
@@ -1410,7 +1412,7 @@ currently selected window instead."
1410 file-name-handler-alist))) 1412 file-name-handler-alist)))
1411 (if same-window (find-file url) (find-file-other-window url)))) 1413 (if same-window (find-file url) (find-file-other-window url))))
1412 1414
1413(put 'browse-url-emacs 'browse-url-browser-kind 'internal) 1415(function-put 'browse-url-emacs 'browse-url-browser-kind 'internal)
1414 1416
1415;;;###autoload 1417;;;###autoload
1416(defun browse-url-gnome-moz (url &optional new-window) 1418(defun browse-url-gnome-moz (url &optional new-window)
@@ -1436,7 +1438,7 @@ used instead of `browse-url-new-window-flag'."
1436 '("--newwin")) 1438 '("--newwin"))
1437 (list "--raise" url)))) 1439 (list "--raise" url))))
1438 1440
1439(put 'browse-url-gnome-moz 'browse-url-browser-kind 'external) 1441(function-put 'browse-url-gnome-moz 'browse-url-browser-kind 'external)
1440 1442
1441;; --- Mosaic --- 1443;; --- Mosaic ---
1442 1444
@@ -1489,7 +1491,7 @@ used instead of `browse-url-new-window-flag'."
1489 (append browse-url-mosaic-arguments (list url))) 1491 (append browse-url-mosaic-arguments (list url)))
1490 (message "Starting %s...done" browse-url-mosaic-program)))) 1492 (message "Starting %s...done" browse-url-mosaic-program))))
1491 1493
1492(put 'browse-url-mosaic 'browse-url-browser-kind 'external) 1494(function-put 'browse-url-mosaic 'browse-url-browser-kind 'external)
1493 1495
1494;; --- Mosaic using CCI --- 1496;; --- Mosaic using CCI ---
1495 1497
@@ -1523,7 +1525,7 @@ used instead of `browse-url-new-window-flag'."
1523 (process-send-string "browse-url" "disconnect\r\n") 1525 (process-send-string "browse-url" "disconnect\r\n")
1524 (delete-process "browse-url")) 1526 (delete-process "browse-url"))
1525 1527
1526(put 'browse-url-cci 'browse-url-browser-kind 'external) 1528(function-put 'browse-url-cci 'browse-url-browser-kind 'external)
1527 1529
1528;; --- Conkeror --- 1530;; --- Conkeror ---
1529;;;###autoload 1531;;;###autoload
@@ -1562,7 +1564,7 @@ NEW-WINDOW instead of `browse-url-new-window-flag'."
1562 "buffer") 1564 "buffer")
1563 url)))))) 1565 url))))))
1564 1566
1565(put 'browse-url-conkeror 'browse-url-browser-kind 'external) 1567(function-put 'browse-url-conkeror 'browse-url-browser-kind 'external)
1566 1568
1567;; --- W3 --- 1569;; --- W3 ---
1568 1570
@@ -1587,7 +1589,7 @@ used instead of `browse-url-new-window-flag'."
1587 (w3-fetch-other-window url) 1589 (w3-fetch-other-window url)
1588 (w3-fetch url))) 1590 (w3-fetch url)))
1589 1591
1590(put 'browse-url-w3 'browse-url-browser-kind 'internal) 1592(function-put 'browse-url-w3 'browse-url-browser-kind 'internal)
1591 1593
1592;;;###autoload 1594;;;###autoload
1593(defun browse-url-w3-gnudoit (url &optional _new-window) 1595(defun browse-url-w3-gnudoit (url &optional _new-window)
@@ -1603,7 +1605,7 @@ The `browse-url-gnudoit-program' program is used with options given by
1603 (list (concat "(w3-fetch \"" url "\")") 1605 (list (concat "(w3-fetch \"" url "\")")
1604 "(raise-frame)")))) 1606 "(raise-frame)"))))
1605 1607
1606(put 'browse-url-w3-gnudoit 'browse-url-browser-kind 'internal) 1608(function-put 'browse-url-w3-gnudoit 'browse-url-browser-kind 'internal)
1607 1609
1608;; --- Lynx in an xterm --- 1610;; --- Lynx in an xterm ---
1609 1611
@@ -1622,7 +1624,7 @@ The optional argument NEW-WINDOW is not used."
1622 ,@browse-url-xterm-args "-e" ,browse-url-text-browser 1624 ,@browse-url-xterm-args "-e" ,browse-url-text-browser
1623 ,url))) 1625 ,url)))
1624 1626
1625(put 'browse-url-text-xterm 'browse-url-browser-kind 'external) 1627(function-put 'browse-url-text-xterm 'browse-url-browser-kind 'external)
1626 1628
1627;; --- Lynx in an Emacs "term" window --- 1629;; --- Lynx in an Emacs "term" window ---
1628 1630
@@ -1698,7 +1700,7 @@ used instead of `browse-url-new-window-flag'."
1698 url 1700 url
1699 "\r"))))) 1701 "\r")))))
1700 1702
1701(put 'browse-url-text-emacs 'browse-url-browser-kind 'internal) 1703(function-put 'browse-url-text-emacs 'browse-url-browser-kind 'internal)
1702 1704
1703;; --- mailto --- 1705;; --- mailto ---
1704 1706
@@ -1747,7 +1749,7 @@ used instead of `browse-url-new-window-flag'."
1747 (unless (bolp) 1749 (unless (bolp)
1748 (insert "\n")))))))) 1750 (insert "\n"))))))))
1749 1751
1750(put 'browse-url-mail 'browse-url-browser-kind 'internal) 1752(function-put 'browse-url-mail 'browse-url-browser-kind 'internal)
1751 1753
1752;; --- man --- 1754;; --- man ---
1753 1755
@@ -1762,7 +1764,7 @@ used instead of `browse-url-new-window-flag'."
1762 ((executable-find manual-program) (man url)) 1764 ((executable-find manual-program) (man url))
1763 (t (woman (replace-regexp-in-string "([[:alnum:]]+)" "" url))))) 1765 (t (woman (replace-regexp-in-string "([[:alnum:]]+)" "" url)))))
1764 1766
1765(put 'browse-url-man 'browse-url-browser-kind 'internal) 1767(function-put 'browse-url-man 'browse-url-browser-kind 'internal)
1766 1768
1767;; --- Random browser --- 1769;; --- Random browser ---
1768 1770
@@ -1781,7 +1783,7 @@ don't offer a form of remote control."
1781 0 nil 1783 0 nil
1782 (append browse-url-generic-args (list url)))) 1784 (append browse-url-generic-args (list url))))
1783 1785
1784(put 'browse-url-generic 'browse-url-browser-kind 'external) 1786(function-put 'browse-url-generic 'browse-url-browser-kind 'external)
1785 1787
1786;;;###autoload 1788;;;###autoload
1787(defun browse-url-kde (url &optional _new-window) 1789(defun browse-url-kde (url &optional _new-window)
@@ -1793,7 +1795,7 @@ The optional argument NEW-WINDOW is not used."
1793 (apply #'start-process (concat "KDE " url) nil browse-url-kde-program 1795 (apply #'start-process (concat "KDE " url) nil browse-url-kde-program
1794 (append browse-url-kde-args (list url)))) 1796 (append browse-url-kde-args (list url))))
1795 1797
1796(put 'browse-url-kde 'browse-url-browser-kind 'external) 1798(function-put 'browse-url-kde 'browse-url-browser-kind 'external)
1797 1799
1798(defun browse-url-elinks-new-window (url) 1800(defun browse-url-elinks-new-window (url)
1799 "Ask the Elinks WWW browser to load URL in a new window." 1801 "Ask the Elinks WWW browser to load URL in a new window."
@@ -1804,7 +1806,8 @@ The optional argument NEW-WINDOW is not used."
1804 browse-url-elinks-wrapper 1806 browse-url-elinks-wrapper
1805 (list "elinks" url))))) 1807 (list "elinks" url)))))
1806 1808
1807(put 'browse-url-elinks-new-window 'browse-url-browser-kind 'external) 1809(function-put 'browse-url-elinks-new-window 'browse-url-browser-kind
1810 'external)
1808 1811
1809;;;###autoload 1812;;;###autoload
1810(defun browse-url-elinks (url &optional new-window) 1813(defun browse-url-elinks (url &optional new-window)
@@ -1827,7 +1830,7 @@ from `browse-url-elinks-wrapper'."
1827 `(lambda (process change) 1830 `(lambda (process change)
1828 (browse-url-elinks-sentinel process ,url)))))) 1831 (browse-url-elinks-sentinel process ,url))))))
1829 1832
1830(put 'browse-url-elinks 'browse-url-browser-kind 'external) 1833(function-put 'browse-url-elinks 'browse-url-browser-kind 'external)
1831 1834
1832(defun browse-url-elinks-sentinel (process url) 1835(defun browse-url-elinks-sentinel (process url)
1833 "Determines if Elinks is running or a new one has to be started." 1836 "Determines if Elinks is running or a new one has to be started."