Browse Source

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
custom
toctan 12 years ago
parent
commit
2d11c0bc4b
  1. 7
      core/prelude-core.el

7
core/prelude-core.el

@ -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))
((search-forward "<html" nil t) (html-mode)))))
(goto-char (point-min))
(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…
Cancel
Save