diff --git a/README.md b/README.md
index 8388019..ba875e2 100644
--- a/README.md
+++ b/README.md
@@ -249,7 +249,6 @@ extensions to keybindings.
Keybinding | Description
-------------------|------------------------------------------------------------
-C-M-h | Kill the previous word(`backward-kill-word`). (as in Bash/Zsh)
C-x \\ | `align-regexp`
C-+ | Increase font size(`text-scale-increase`).
C-- | Decrease font size(`text-scale-decrease`).
@@ -259,6 +258,7 @@ Keybinding | Description
C-x m | Start `eshell`.
C-x M-m | Start your default shell.
C-x C-m | Alias for `M-x`.
+M-X | Like `M-x` but limited to commands that are relevant to the active major mode.
C-h A | Run `apropos` (search in all Emacs symbols).
C-h C-m | Display key bindings of current major mode and descriptions of every binding.
M-/ | Run `hippie-expand` (a replacement for the default `dabbrev-expand`).
@@ -303,15 +303,15 @@ Keybinding | Description
C-c . - | Decrement integer at point. Default is -1.
C-c . * | Multiply integer at point. Default is *2.
C-c . / | Divide integer at point. Default is /2.
-C-c . \ | Modulo integer at point. Default is modulo 2.
+C-c . \\ | Modulo integer at point. Default is modulo 2.
C-c . ^ | Power to the integer at point. Default is ^2.
C-c . < | Left-shift integer at point. Default is 1 position to the left.
C-c . > | Right-shift integer at point. Default is 1 position to the right.
C-c . # | Convert integer at point to specified base. Default is 10.
C-c . % | Replace integer at point with another specified integer.
C-c . ' | Perform arithmetic operations on integer at point. User specifies the operator.
+Super-g | Toggle between God mode and non-God mode
Super-r | Recent files
-Super-x | Expand region
Super-j | Join lines
Super-k | Kill whole line
Super-m m | Magit status
@@ -344,7 +344,8 @@ Keybinding | Description
C-c p f | Display a list of all files in the project. With a prefix argument it will clear the cache first.
C-c p d | Display a list of all directories in the project. With a prefix argument it will clear the cache first.
C-c p T | Display a list of all test files(specs, features, etc) in the project.
-C-c p g | Run grep on the files in the project.
+C-c p s g | Run grep on the files in the project.
+M-- C-c p s g | Run grep on `projectile-grep-default-files` in the project.
C-c p b | Display a list of all project buffers currently open.
C-c p o | Runs `multi-occur` on all project buffers currently open.
C-c p r | Runs interactive query-replace on all files in the projects.
@@ -353,11 +354,13 @@ Keybinding | Description
C-c p k | Kills all project buffers.
C-c p D | Opens the root of the project in `dired`.
C-c p e | Shows a list of recently visited project files.
+C-c p s a | Runs `ack` on the project. Requires the presence of `ack-and-a-half`.
+C-c p s s | Runs `ag` on the project. Requires the presence of `ag.el`.
C-c p a | Runs `ack` on the project. Requires the presence of `ack-and-a-half`.
C-c p c | Runs a standard compilation command for your type of project.
C-c p p | Runs a standard test command for your type of project.
C-c p z | Adds the currently visited to the cache.
-C-c p s | Display a list of known projects you can switch to.
+C-c p p | Display a list of known projects you can switch to.
Prelude adds an extra keymap prefix `S-p` (`S` stands for
`Super`), so you can use `S-p` instead of `C-c p`.
diff --git a/core/prelude-core.el b/core/prelude-core.el
index 265803f..5830d1d 100644
--- a/core/prelude-core.el
+++ b/core/prelude-core.el
@@ -379,10 +379,10 @@ Doesn't mess with special buffers."
(defvar prelude-tips
'("Press to open a file with external program."
- "Press or to navigate a project's files with ido."
- "Press or to run grep on a project."
- "Press or to switch between projects."
- "Press or to expand the selected region."
+ "Press to navigate a project's files with ido."
+ "Press to run grep on a project."
+ "Press to switch between projects."
+ "Press to expand the selected region."
"Press to search in Google."
"Press to search in GitHub."
"Press to search in YouTube."
@@ -390,7 +390,7 @@ Doesn't mess with special buffers."
"Press to rename the current buffer and the file it's visiting if any."
"Press to open a terminal in Emacs."
"Press to kill all the buffers, but the active one."
- "Press or to run magit-status."
+ "Press to run magit-status."
"Press to delete the current file and buffer."
"Press to swap two windows."
"Press or to open a line beneath the current one."
diff --git a/modules/prelude-python.el b/modules/prelude-python.el
index d3e727d..1f7a44e 100644
--- a/modules/prelude-python.el
+++ b/modules/prelude-python.el
@@ -35,10 +35,54 @@
(require 'prelude-programming)
+;; Copy pasted from ruby-mode.el
+(defun prelude-python--encoding-comment-required-p ()
+ (re-search-forward "[^\0-\177]" nil t))
+
+(defun prelude-python--detect-encoding ()
+ (let ((coding-system
+ (or save-buffer-coding-system
+ buffer-file-coding-system)))
+ (if coding-system
+ (symbol-name
+ (or (coding-system-get coding-system 'mime-charset)
+ (coding-system-change-eol-conversion coding-system nil)))
+ "ascii-8bit")))
+
+(defun prelude-python--insert-coding-comment (encoding)
+ (let ((newlines (if (looking-at "^\\s *$") "\n" "\n\n")))
+ (insert (format "# coding: %s" encoding) newlines)))
+
+(defun prelude-python-mode-set-encoding ()
+ "Insert a magic comment header with the proper encoding if necessary."
+ (save-excursion
+ (widen)
+ (goto-char (point-min))
+ (when (prelude-python--encoding-comment-required-p)
+ (goto-char (point-min))
+ (let ((coding-system (prelude-python--detect-encoding)))
+ (when coding-system
+ (if (looking-at "^#!") (beginning-of-line 2))
+ (cond ((looking-at "\\s *#\\s *.*\\(en\\)?coding\\s *:\\s *\\([-a-z0-9_]*\\)")
+ ;; update existing encoding comment if necessary
+ (unless (string= (match-string 2) coding-system)
+ (goto-char (match-beginning 2))
+ (delete-region (point) (match-end 2))
+ (insert coding-system)))
+ ((looking-at "\\s *#.*coding\\s *[:=]"))
+ (t (prelude-python--insert-coding-comment coding-system)))
+ (when (buffer-modified-p)
+ (basic-save-buffer-1)))))))
+
(defun prelude-python-mode-defaults ()
"Defaults for Python programming."
(subword-mode +1)
- (electric-indent-mode -1))
+ (setq-local electric-layout-rules
+ '((?: . (lambda ()
+ (if (python-info-statement-starts-block-p)
+ 'after)))))
+ (electric-layout-mode +1)
+ (add-hook 'after-save-hook 'prelude-python-mode-set-encoding nil 'local))
(setq prelude-python-mode-hook 'prelude-python-mode-defaults)