The python PEP 8 style guide recommends that inline comments be separated by two spaces between the rest of the line . However, Emacs defaults to starting comment-dwimor indent-for-commentplacing only one space between the end of the line and the comment. Is there a way to change this default behavior in emacs?
comment-dwim
indent-for-comment
I am running Emacs 23.3.1
This should do what you want:
(add-hook 'python-mode-hook (lambda () (set (make-local-variable 'comment-inline-offset) 2)))
Try to set comment-startto " # "(one space before, one basement).
comment-start
" # "
M-x set-variable comment-start " # "
, , :
(defun my-comment-indent () (interactive) (end-of-line) (let ((comment-column (+ 2 (current-column)))) (comment-indent)))
emacs C-h v RET comment-inline-offset, @And.
C-h v RET comment-inline-offset
Here's a simplified version:
(add-hook 'python-mode-hook (lambda () (setq-local comment-inline-offset 2)))