Mercurial > emacs
annotate lisp/url/url-misc.el @ 59472:1e81e65f3201
(Info-history-forward): New variable.
(Info-select-node): Reset Info-history-forward to nil.
(Info-last): Turn into defalias.
(Info-history-back): Rename from Info-last.
Add current node to Info-history-forward.
(Info-history-forward): New fun.
(Info-mode-map): Replace Info-last by Info-history-back.
Bind Info-history-forward to "r".
(Info-mode-menu): Replace Info-last by Info-history-back.
Fix menu item text. Add menu item for Info-history-forward.
(info-tool-bar-map): Replace Info-last by Info-history-back.
Replace its icon "undo" by "back_arrow". Add icon "fwd_arrow"
for Info-history-forward.
(Info-mode): Replace Info-last by Info-history-back in docstring.
Add local variable Info-history-forward.
(Info-goto-emacs-command-node): Replace Info-last by Info-history-back.
author | Juri Linkov <juri@jurta.org> |
---|---|
date | Tue, 11 Jan 2005 21:57:16 +0000 |
parents | 2954cb243379 |
children | a8fa7c632ee4 ae7fab96922c |
rev | line source |
---|---|
54695 | 1 ;;; url-misc.el --- Misc Uniform Resource Locator retrieval code |
57612 | 2 |
3 ;; Copyright (c) 1996,1997,1998,1999,2002 Free Software Foundation, Inc. | |
4 | |
54695 | 5 ;; Keywords: comm, data, processes |
6 | |
57612 | 7 ;; This file is part of GNU Emacs. |
8 | |
9 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;; any later version. | |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 ;; Boston, MA 02111-1307, USA. | |
23 | |
24 ;;; Code: | |
54695 | 25 |
57512
44bc5df842b7
Load cl at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
57427
diff
changeset
|
26 (eval-when-compile (require 'cl)) |
54695 | 27 (require 'url-vars) |
28 (require 'url-parse) | |
29 (autoload 'Info-goto-node "info" "" t) | |
30 (autoload 'man "man" nil t) | |
31 | |
32 ;;;###autoload | |
33 (defun url-man (url) | |
34 "Fetch a Unix manual page URL." | |
35 (man (url-filename url)) | |
36 nil) | |
37 | |
38 ;;;###autoload | |
39 (defun url-info (url) | |
40 "Fetch a GNU Info URL." | |
41 ;; Fetch an info node | |
42 (let* ((fname (url-filename url)) | |
43 (node (url-unhex-string (or (url-target url) "Top")))) | |
44 (if (and fname node) | |
45 (Info-goto-node (concat "(" fname ")" node)) | |
46 (error "Malformed url: %s" (url-recreate-url url))) | |
47 nil)) | |
48 | |
49 (defun url-do-terminal-emulator (type server port user) | |
50 (terminal-emulator | |
51 (generate-new-buffer (format "%s%s" (if user (concat user "@") "") server)) | |
52 (case type | |
53 (rlogin "rlogin") | |
54 (telnet "telnet") | |
55 (tn3270 "tn3270") | |
56 (otherwise | |
57 (error "Unknown terminal emulator required: %s" type))) | |
58 (case type | |
59 (rlogin | |
60 (if user | |
61 (list server "-l" user) | |
62 (list server))) | |
63 (telnet | |
64 (if user (message "Please log in as user: %s" user)) | |
65 (if port | |
66 (list server port) | |
67 (list server))) | |
68 (tn3270 | |
69 (if user (message "Please log in as user: %s" user)) | |
70 (list server))))) | |
71 | |
72 ;;;###autoload | |
73 (defun url-generic-emulator-loader (url) | |
74 (let* ((type (intern (downcase (url-type url)))) | |
75 (server (url-host url)) | |
76 (name (url-user url)) | |
77 (port (url-port url))) | |
78 (url-do-terminal-emulator type server port name)) | |
79 nil) | |
80 | |
81 ;;;###autoload | |
82 (defalias 'url-rlogin 'url-generic-emulator-loader) | |
83 ;;;###autoload | |
84 (defalias 'url-telnet 'url-generic-emulator-loader) | |
85 ;;;###autoload | |
86 (defalias 'url-tn3270 'url-generic-emulator-loader) | |
87 | |
88 ;; RFC 2397 | |
89 ;;;###autoload | |
90 (defun url-data (url) | |
91 "Fetch a data URL (RFC 2397)." | |
92 (let ((mediatype nil) | |
93 ;; The mediatype may need to be hex-encoded too -- see the RFC. | |
94 (desc (url-unhex-string (url-filename url))) | |
95 (encoding "8bit") | |
96 (data nil)) | |
97 (save-excursion | |
98 (if (not (string-match "\\([^,]*\\)?," desc)) | |
99 (error "Malformed data URL: %s" desc) | |
100 (setq mediatype (match-string 1 desc)) | |
101 (if (and mediatype (string-match ";base64\\'" mediatype)) | |
102 (setq mediatype (substring mediatype 0 (match-beginning 0)) | |
103 encoding "base64")) | |
104 (if (or (null mediatype) | |
105 (eq ?\; (aref mediatype 0))) | |
106 (setq mediatype (concat "text/plain" mediatype))) | |
107 (setq data (url-unhex-string (substring desc (match-end 0))))) | |
108 (set-buffer (generate-new-buffer " *url-data*")) | |
109 (mm-disable-multibyte) | |
110 (insert (format "Content-Length: %d\n" (length data)) | |
111 "Content-Type: " mediatype "\n" | |
112 "Content-Encoding: " encoding "\n" | |
113 "\n") | |
114 (if data (insert data)) | |
115 (current-buffer)))) | |
116 | |
117 (provide 'url-misc) | |
54699 | 118 |
119 ;;; arch-tag: 8c544e1b-d8bc-40a6-b319-f1f37fef65a0 | |
57612 | 120 ;;; url-misc.el ends here |