A better prelude-view-url
- remove HTTP headers, what we care most of the time is the content - `set-auto-mode` is way better than the naive xml, html tag check
This commit is contained in:
parent
237104bbae
commit
2d11c0bc4b
1 changed files with 5 additions and 2 deletions
|
@ -266,8 +266,11 @@ there's a region, all lines that region covers will be duplicated."
|
||||||
(url (read-from-minibuffer "URL: " default)))
|
(url (read-from-minibuffer "URL: " default)))
|
||||||
(switch-to-buffer (url-retrieve-synchronously url))
|
(switch-to-buffer (url-retrieve-synchronously url))
|
||||||
(rename-buffer url t)
|
(rename-buffer url t)
|
||||||
(cond ((search-forward "<?xml" nil t) (nxml-mode))
|
(goto-char (point-min))
|
||||||
((search-forward "<html" nil t) (html-mode)))))
|
(re-search-forward "^$")
|
||||||
|
(delete-region (point-min) (point))
|
||||||
|
(delete-blank-lines)
|
||||||
|
(set-auto-mode)))
|
||||||
|
|
||||||
(defun prelude-cleanup-buffer-or-region ()
|
(defun prelude-cleanup-buffer-or-region ()
|
||||||
"Cleanup a region if selected, otherwise the whole buffer."
|
"Cleanup a region if selected, otherwise the whole buffer."
|
||||||
|
|
Loading…
Reference in a new issue