diff options
author | Philipp Haselwarter <philipp.haselwarter@gmx.de> | 2012-03-25 14:37:24 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2012-03-25 14:37:24 -0400 |
commit | 8eb5d48f36bbb758d46a867c52fbc23d7ad7d71f (patch) | |
tree | 590247eb31556795b74c1f230112fae9ba82e330 /lisp/newcomment.el | |
parent | 3f99e6e686e4a2db4b0c13679d211fdbb9b48dae (diff) | |
download | emacs-8eb5d48f36bbb758d46a867c52fbc23d7ad7d71f.tar.gz |
* lisp/newcomment.el (comment-inline-offset): New custom var.
(comment-indent): Use it.
Fixes: debbugs:11090
Diffstat (limited to 'lisp/newcomment.el')
-rw-r--r-- | lisp/newcomment.el | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lisp/newcomment.el b/lisp/newcomment.el index a1d77ccc6e0..2d5608cb225 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -269,6 +269,19 @@ makes the comment easier to read. Default is 1. nil means 0." :group 'comment) ;;;###autoload +(defcustom comment-inline-offset 1 + "Inline comments have to be preceded by at least this many spaces. +This is usefull when style-conventions require a certain minimal offset. +Python's PEP8 for example recommends two spaces, so you could do: + +\(add-hook 'python-mode-hook + (lambda nil (set (make-local-variable 'comment-inline-offset) 2))) + +See `comment-padding' for whole-line comments." + :type 'integer + :group 'comment) + +;;;###autoload (defcustom comment-multi-line nil "Non-nil means `comment-indent-new-line' continues comments. That is, it inserts no new terminator or starter. @@ -685,7 +698,7 @@ If CONTINUE is non-nil, use the `comment-continue' markers if any." (save-excursion (skip-chars-backward " \t") (unless (bolp) - (setq indent (max indent (1+ (current-column)))))) + (setq indent (max indent (+ (current-column) comment-inline-offset))))) ;; If that's different from comment's current position, change it. (unless (= (current-column) indent) (delete-region (point) (progn (skip-chars-backward " \t") (point))) |