Browse Source

Merge pull request #628 from toctan/view-url

A better `prelude-view-url`
custom
Bozhidar Batsov 12 years ago
parent
commit
c3eac31f62
  1. 2
      README.md
  2. 7
      core/prelude-core.el

2
README.md

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

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