[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#11090: 24.0.94; Allow customization of inline-comment offset
From: |
Stefan Monnier |
Subject: |
bug#11090: 24.0.94; Allow customization of inline-comment offset |
Date: |
Sun, 25 Mar 2012 14:41:27 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) |
> The attached patch allows for `comment-indent' to configure that offset,
> that is currently hard-coded to one space, by introducing the new
> variable `comment-inline-offset'.
I think it's a good idea, thank you.
Installed in the `pending' branch, for 24.2.
I also installed the following patch on top of it.
Stefan
=== modified file 'lisp/newcomment.el'
--- lisp/newcomment.el 2012-03-25 18:37:24 +0000
+++ lisp/newcomment.el 2012-03-25 18:38:46 +0000
@@ -268,7 +268,6 @@
:type '(choice string integer (const nil))
: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.
@@ -598,7 +597,7 @@
(save-excursion (end-of-line) (current-column)))))
(other nil)
(min (save-excursion (skip-chars-backward " \t")
- (1+ (current-column)))))
+ (+ comment-inline-offset (current-column)))))
;; Fix up the range.
(if (< max min) (setq max min))
;; Don't move past the fill column.
@@ -698,7 +697,8 @@
(save-excursion
(skip-chars-backward " \t")
(unless (bolp)
- (setq indent (max indent (+ (current-column)
comment-inline-offset)))))
+ (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)))