GNU bug report logs - #11090
24.0.94; Allow customization of inline-comment offset

Previous Next

Package: emacs;

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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11090 in the body.
You can then email your comments to 11090 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11090; Package emacs. (Sun, 25 Mar 2012 17:25:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Philipp Haselwarter <philipp.haselwarter <at> gmx.de>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 25 Mar 2012 17:25:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Philipp Haselwarter <philipp.haselwarter <at> gmx.de>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.94; Allow customization of inline-comment offset
Date: Sun, 25 Mar 2012 18:52:35 +0200
[Message part 1 (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)]

Reply sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
You have taken responsibility. (Sun, 25 Mar 2012 19:13:01 GMT) Full text and rfc822 format available.

Notification sent to Philipp Haselwarter <philipp.haselwarter <at> gmx.de>:
bug acknowledged by developer. (Sun, 25 Mar 2012 19:13:01 GMT) Full text and rfc822 format available.

Message #10 received at 11090-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Philipp Haselwarter <philipp.haselwarter <at> gmx.de>
Cc: 11090-done <at> debbugs.gnu.org
Subject: Re: bug#11090: 24.0.94; Allow customization of inline-comment offset
Date: Sun, 25 Mar 2012 14:41:27 -0400
> 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)))





bug Marked as fixed in versions 24.2. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Tue, 27 Mar 2012 17:07:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 25 Apr 2012 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 13 years and 56 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.