aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Haselwarter2012-03-25 14:37:24 -0400
committerStefan Monnier2012-03-25 14:37:24 -0400
commit8eb5d48f36bbb758d46a867c52fbc23d7ad7d71f (patch)
tree590247eb31556795b74c1f230112fae9ba82e330
parent3f99e6e686e4a2db4b0c13679d211fdbb9b48dae (diff)
downloademacs-8eb5d48f36bbb758d46a867c52fbc23d7ad7d71f.tar.gz
emacs-8eb5d48f36bbb758d46a867c52fbc23d7ad7d71f.zip
* lisp/newcomment.el (comment-inline-offset): New custom var.
(comment-indent): Use it. Fixes: debbugs:11090
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/newcomment.el15
2 files changed, 19 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 581ddc3788e..729795b9bab 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12012-03-25 Philipp Haselwarter <philipp.haselwarter@gmx.de> (tiny change)
2
3 * newcomment.el (comment-inline-offset): New custom var (bug#11090).
4 (comment-indent): Use it.
5
12012-02-15 Stefan Monnier <monnier@iro.umontreal.ca> 62012-02-15 Stefan Monnier <monnier@iro.umontreal.ca>
2 7
3 * emacs-lisp/smie.el: Provide smarter auto-filling. 8 * emacs-lisp/smie.el: Provide smarter auto-filling.
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."
269 :group 'comment) 269 :group 'comment)
270 270
271;;;###autoload 271;;;###autoload
272(defcustom comment-inline-offset 1
273 "Inline comments have to be preceded by at least this many spaces.
274This is usefull when style-conventions require a certain minimal offset.
275Python's PEP8 for example recommends two spaces, so you could do:
276
277\(add-hook 'python-mode-hook
278 (lambda nil (set (make-local-variable 'comment-inline-offset) 2)))
279
280See `comment-padding' for whole-line comments."
281 :type 'integer
282 :group 'comment)
283
284;;;###autoload
272(defcustom comment-multi-line nil 285(defcustom comment-multi-line nil
273 "Non-nil means `comment-indent-new-line' continues comments. 286 "Non-nil means `comment-indent-new-line' continues comments.
274That is, it inserts no new terminator or starter. 287That is, it inserts no new terminator or starter.
@@ -685,7 +698,7 @@ If CONTINUE is non-nil, use the `comment-continue' markers if any."
685 (save-excursion 698 (save-excursion
686 (skip-chars-backward " \t") 699 (skip-chars-backward " \t")
687 (unless (bolp) 700 (unless (bolp)
688 (setq indent (max indent (1+ (current-column)))))) 701 (setq indent (max indent (+ (current-column) comment-inline-offset)))))
689 ;; If that's different from comment's current position, change it. 702 ;; If that's different from comment's current position, change it.
690 (unless (= (current-column) indent) 703 (unless (= (current-column) indent)
691 (delete-region (point) (progn (skip-chars-backward " \t") (point))) 704 (delete-region (point) (progn (skip-chars-backward " \t") (point)))