Mercurial > emacs
annotate lisp/url/url-misc.el @ 59534:9bad65481674
2005-01-14 Carsten Dominik <dominik@science.uva.nl>
* reftex-cite.el (reftex-bib-sort-year): Catch the case if the
year is not given.
* reftex-ref.el (reftex-replace-prefix-escapes): Added new escapes
%m and %M, fixed bug with %F by adding save-match-data.
(reftex-reference): Removed ?. from list of spaces.
(reftex-label-info): Added automatic label prefix recognition
* reftex-index.el (reftex-index-next-phrase): Added slave
parameter to call of `reftex-index-this-phrase'
(reftex-index-this-phrase): New optional argument
(reftex-index-region-phrases): Added slave parameter to call of
`reftex-index-this-phrase'
(reftex-display-index): New argument redo
(reftex-index-rescan): Added 'redo to arguments of
`reftex-display-index'
(reftex-index-Rescan, reftex-index-revert)
(reftex-index-switch-index-tag): Added 'redo to arguments of
`reftex-display-index'
(reftex-index-make-phrase-regexp): Fixed bug with case-sensitive
indexing. Fixed bug with matching is there is a quote before or
after the word.
* reftex-cite.el (reftex-all-used-citation-keys): Fix bug when
collecting citation keys in lines with comments.
(reftex-citation): Prefix argument no longer rescans the document,
but forces prompting for optional arguments of cite macros.
(reftex-do-citation): Prompting for optional arguments
implemented.
* reftex-vars.el (reftex-cite-format-builtin): Added optional
arguments to most cite commands.
(reftex-cite-cleanup-optional-args): New option
(reftex-cite-prompt-optional-args): New option.
(reftex-trust-label-prefix): New option
* reftex-toc.el (reftex-toc-find-section): Added push-mark before
changing the position in the buffer.
* reftex.el (reftex-prefix-to-typekey-alist): New variable
(reftex-compile-variables): Compute reftex-prefix-to-typekey-alist
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Fri, 14 Jan 2005 10:12:03 +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 |