diff options
| author | Lars Ingebrigtsen | 2018-04-14 00:08:26 +0200 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2018-04-14 00:08:26 +0200 |
| commit | e442879b5a963a6eb37403fe09f476e7ee8e0f55 (patch) | |
| tree | 437d2e5fa91a7004d999361a9ce5af0f2968de3b | |
| parent | 4575ae5a9c5589ac903362486951f0d36c8ff8ee (diff) | |
| download | emacs-e442879b5a963a6eb37403fe09f476e7ee8e0f55.tar.gz emacs-e442879b5a963a6eb37403fe09f476e7ee8e0f55.zip | |
Make the url file: handler be less clever
* doc/misc/url.texi (file/ftp): Remove mention of the
url-directory-index-file variable, which is no longer consulted.
* lisp/url/url-file.el (url-file-build-filename): Remove the DWIM
code from the file: handler (bug#30195): It would look for
index.html in a directory if we asked it to fetch the directory.
Determining what to do in a directory should be left up to the
programs that use this low-level library. If the library decides
to load a different file than we specified, then things start
falling apart, as demonstrated by this bug report.
| -rw-r--r-- | doc/misc/url.texi | 5 | ||||
| -rw-r--r-- | etc/NEWS | 10 | ||||
| -rw-r--r-- | lisp/url/url-file.el | 11 |
3 files changed, 9 insertions, 17 deletions
diff --git a/doc/misc/url.texi b/doc/misc/url.texi index fb0a55b3c86..8967c71301d 100644 --- a/doc/misc/url.texi +++ b/doc/misc/url.texi | |||
| @@ -571,11 +571,6 @@ if it has the file suffix @file{.z}, @file{.gz}, @file{.Z}, | |||
| 571 | hard-coded, and cannot be altered by customizing | 571 | hard-coded, and cannot be altered by customizing |
| 572 | @code{jka-compr-compression-info-list}.) | 572 | @code{jka-compr-compression-info-list}.) |
| 573 | 573 | ||
| 574 | @defopt url-directory-index-file | ||
| 575 | This option specifies the filename to look for when a @code{file} or | ||
| 576 | @code{ftp} URL specifies a directory. The default is | ||
| 577 | @file{index.html}. If this file exists and is readable, it is viewed. | ||
| 578 | Otherwise, Emacs visits the directory using Dired. | ||
| 579 | @end defopt | 574 | @end defopt |
| 580 | 575 | ||
| 581 | @node info | 576 | @node info |
| @@ -540,7 +540,15 @@ For instance, if /etc/mailcap has an entry for image/gif, that one | |||
| 540 | will be chosen even if you have an entry for image/* in your | 540 | will be chosen even if you have an entry for image/* in your |
| 541 | ~/.mailcap file. But with the new method, entries from ~/.mailcap | 541 | ~/.mailcap file. But with the new method, entries from ~/.mailcap |
| 542 | overrides all system and Emacs-provided defaults. To get the old | 542 | overrides all system and Emacs-provided defaults. To get the old |
| 543 | method back, set `mailcap-prefer-mailcap-viewers' to nil | 543 | method back, set `mailcap-prefer-mailcap-viewers' to nil. |
| 544 | |||
| 545 | |||
| 546 | ** URL | ||
| 547 | |||
| 548 | *** The file: handler no longer looks for index.html in directories if | ||
| 549 | you ask it for a file:///dir URL. Since this is a low-level library, | ||
| 550 | such decisions (if they are to be made at all) are left to | ||
| 551 | higher-level functions. | ||
| 544 | 552 | ||
| 545 | 553 | ||
| 546 | +++ | 554 | +++ |
diff --git a/lisp/url/url-file.el b/lisp/url/url-file.el index 4fac4060237..92edd9901ef 100644 --- a/lisp/url/url-file.el +++ b/lisp/url/url-file.el | |||
| @@ -142,17 +142,6 @@ to them." | |||
| 142 | (not (string-match "/\\'" filename))) | 142 | (not (string-match "/\\'" filename))) |
| 143 | (setf (url-filename url) (format "%s/" filename))) | 143 | (setf (url-filename url) (format "%s/" filename))) |
| 144 | 144 | ||
| 145 | |||
| 146 | ;; If it is a directory, look for an index file first. | ||
| 147 | (if (and (file-directory-p filename) | ||
| 148 | url-directory-index-file | ||
| 149 | (setq pos-index (expand-file-name url-directory-index-file filename)) | ||
| 150 | (file-exists-p pos-index) | ||
| 151 | (file-readable-p pos-index)) | ||
| 152 | (setq filename pos-index)) | ||
| 153 | |||
| 154 | ;; Find the (possibly compressed) file | ||
| 155 | (setq filename (url-file-find-possibly-compressed-file filename)) | ||
| 156 | filename)) | 145 | filename)) |
| 157 | 146 | ||
| 158 | ;;;###autoload | 147 | ;;;###autoload |