Merge pull request #628 from toctan/view-url

A better `prelude-view-url`
This commit is contained in:
Bozhidar Batsov 2014-07-30 15:55:14 +03:00
commit c3eac31f62
2 changed files with 6 additions and 3 deletions

View file

@ -286,7 +286,7 @@ Keybinding | Description
<kbd>C-c n</kbd> | Fix indentation in buffer and strip whitespace. <kbd>C-c n</kbd> | Fix indentation in buffer and strip whitespace.
<kbd>C-c f</kbd> | Open recently visited file. <kbd>C-c f</kbd> | Open recently visited file.
<kbd>C-M-\\</kbd> | Indent region (if selected) or the entire buffer. <kbd>C-M-\\</kbd> | Indent region (if selected) or the entire buffer.
<kbd>C-c u</kbd> | Open URL in your default browser. <kbd>C-c u</kbd> | Open a new buffer containing the contents of URL.
<kbd>C-c e</kbd> | Eval a bit of Emacs Lisp code and replace it with its result. <kbd>C-c e</kbd> | Eval a bit of Emacs Lisp code and replace it with its result.
<kbd>C-c s</kbd> | Swap two active windows. <kbd>C-c s</kbd> | Swap two active windows.
<kbd>C-c D</kbd> | Delete current file and buffer. <kbd>C-c D</kbd> | Delete current file and buffer.

View file

@ -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."