emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#11090: closed (24.0.94; Allow customization of inl


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#11090: closed (24.0.94; Allow customization of inline-comment offset)
Date: Sun, 25 Mar 2012 19:13:01 +0000

Your message dated Sun, 25 Mar 2012 14:41:27 -0400
with message-id <address@hidden>
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
address@hidden)


-- 
11090: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11090
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 24.0.94; Allow customization of inline-comment offset Date: Sun, 25 Mar 2012 18:52:35 +0200

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

Attachment: 0001-Allow-customization-of-the-offset-between-code-and-i.patch
Description: Text Data


--- End Message ---
--- Begin Message --- Subject: Re: 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)))



--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]