GNU bug report logs -
#11090
24.0.94; Allow customization of inline-comment offset
Previous Next
Reported by: Philipp Haselwarter <philipp.haselwarter <at> gmx.de>
Date: Sun, 25 Mar 2012 17:25:01 UTC
Severity: normal
Found in version 24.0.94
Fixed in version 24.2
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Sun, 25 Mar 2012 14:41:27 -0400
with message-id <jwvy5qofs7i.fsf-monnier+emacs <at> gnu.org>
and subject line Re: bug#11090: 24.0.94; Allow customization of inline-comment offset
has caused the debbugs.gnu.org bug report #11090,
regarding 24.0.94; Allow customization of inline-comment offset
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
11090: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11090
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (text/plain, inline)]
When I ran pep8 over some python code it indicated that the offset
between code and comments on the same line should be at least two
whitespace characters.
Ref.:
http://www.python.org/dev/peps/pep-0008/#inline-comments
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'.
The default behavior remains unchanged.
--
Philipp Haselwarter
[0001-Allow-customization-of-the-offset-between-code-and-i.patch (text/x-patch, attachment)]
[Message part 5 (message/rfc822, inline)]
> 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)))
This bug report was last modified 13 years and 57 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.