From unknown Wed Jun 18 23:17:59 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#11090 <11090@debbugs.gnu.org> To: bug#11090 <11090@debbugs.gnu.org> Subject: Status: 24.0.94; Allow customization of inline-comment offset Reply-To: bug#11090 <11090@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:17:59 +0000 retitle 11090 24.0.94; Allow customization of inline-comment offset reassign 11090 emacs submitter 11090 Philipp Haselwarter severity 11090 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 25 13:24:11 2012 Received: (at submit) by debbugs.gnu.org; 25 Mar 2012 17:24:11 +0000 Received: from localhost ([127.0.0.1]:38457 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SBrAm-0007Qz-RO for submit@debbugs.gnu.org; Sun, 25 Mar 2012 13:24:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34884) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SBrAV-0007QH-Ux for submit@debbugs.gnu.org; Sun, 25 Mar 2012 13:24:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SBqgP-0006nQ-AM for submit@debbugs.gnu.org; Sun, 25 Mar 2012 12:52:46 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:38563) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SBqgP-0006nM-7O for submit@debbugs.gnu.org; Sun, 25 Mar 2012 12:52:45 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SBqgN-00046E-Bg for bug-gnu-emacs@gnu.org; Sun, 25 Mar 2012 12:52:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SBqgL-0006n8-58 for bug-gnu-emacs@gnu.org; Sun, 25 Mar 2012 12:52:42 -0400 Received: from mailout-de.gmx.net ([213.165.64.22]:35181) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1SBqgK-0006mX-Rn for bug-gnu-emacs@gnu.org; Sun, 25 Mar 2012 12:52:41 -0400 Received: (qmail invoked by alias); 25 Mar 2012 16:52:37 -0000 Received: from 104.163.112.78.rev.sfr.net (EHLO nzebook.haselwarter.org) [78.112.163.104] by mail.gmx.net (mp020) with SMTP; 25 Mar 2012 18:52:37 +0200 X-Authenticated: #26138819 X-Provags-ID: V01U2FsdGVkX18BRCsL+EAB0AJW5JoEpHHVxTLheV+EJ0CMuXtew9 I2Os6sJdfwnPpR From: Philipp Haselwarter To: bug-gnu-emacs@gnu.org Subject: 24.0.94; Allow customization of inline-comment offset X-NSA-Fodder: Rand Corporation Sundevil Syria AMW espionage PET Defcon argus Date: Sun, 25 Mar 2012 18:52:35 +0200 Message-ID: <87ehsgmxm4.fsf@nzebook.haselwarter.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="Skipjack/asset/computer-terrorism/White-Water/xncJ2WzDoi" X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) --Skipjack/asset/computer-terrorism/White-Water/xncJ2WzDoi Content-Type: text/plain 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 --Skipjack/asset/computer-terrorism/White-Water/xncJ2WzDoi Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Allow-customization-of-the-offset-between-code-and-i.patch >From 15e86f0b218b7a1bd32426c71bad930208e5606a Mon Sep 17 00:00:00 2001 From: Philipp Haselwarter Date: Sun, 25 Mar 2012 18:32:11 +0200 Subject: [PATCH] Allow customization of the offset between code and inline-comments. * lisp/newcomment.el (comment-inline-offset): New variable. (comment-indent): Honor comment-inline-offset. --- lisp/newcomment.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 40bb36d..c78a3a1 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -270,6 +270,19 @@ makes the comment easier to read. Default is 1. nil means 0." :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. +Python's PEP8 for example recommends two spaces, so you could do: + +\(add-hook 'python-mode-hook + (lambda nil (set (make-local-variable 'comment-inline-offset) 2))) + +See `comment-padding' for whole-line comments." + :type 'integer + :group 'comment) + +;;;###autoload (defcustom comment-multi-line nil "Non-nil means `comment-indent-new-line' continues comments. That is, it inserts no new terminator or starter. @@ -687,7 +700,7 @@ If CONTINUE is non-nil, use the `comment-continue' markers if any." (save-excursion (skip-chars-backward " \t") (unless (bolp) - (setq indent (max indent (1+ (current-column)))))) + (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))) -- 1.7.9.4 --Skipjack/asset/computer-terrorism/White-Water/xncJ2WzDoi-- From debbugs-submit-bounces@debbugs.gnu.org Sun Mar 25 15:13:00 2012 Received: (at 11090-done) by debbugs.gnu.org; 25 Mar 2012 19:13:00 +0000 Received: from localhost ([127.0.0.1]:38561 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SBss7-0001fJ-AA for submit@debbugs.gnu.org; Sun, 25 Mar 2012 15:12:59 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.183]:62984) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SBsrh-0001ej-GX for 11090-done@debbugs.gnu.org; Sun, 25 Mar 2012 15:12:52 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AicFAKU/KE9FpYqr/2dsb2JhbACBX5x7eYhwnhmGGQSbGYQJ X-IronPort-AV: E=Sophos;i="4.73,1,1325480400"; d="scan'208";a="170026256" Received: from 69-165-138-171.dsl.teksavvy.com (HELO pastel.home) ([69.165.138.171]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 25 Mar 2012 14:41:27 -0400 Received: by pastel.home (Postfix, from userid 20848) id 71D1A58F52; Sun, 25 Mar 2012 14:41:27 -0400 (EDT) From: Stefan Monnier To: Philipp Haselwarter Subject: Re: bug#11090: 24.0.94; Allow customization of inline-comment offset Message-ID: References: <87ehsgmxm4.fsf@nzebook.haselwarter.org> Date: Sun, 25 Mar 2012 14:41:27 -0400 In-Reply-To: <87ehsgmxm4.fsf@nzebook.haselwarter.org> (Philipp Haselwarter's message of "Sun, 25 Mar 2012 18:52:35 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11090-done Cc: 11090-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > 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))) From debbugs-submit-bounces@debbugs.gnu.org Tue Mar 27 13:06:56 2012 Received: (at control) by debbugs.gnu.org; 27 Mar 2012 17:06:56 +0000 Received: from localhost ([127.0.0.1]:41526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SCZrC-0001KJ-KX for submit@debbugs.gnu.org; Tue, 27 Mar 2012 13:06:56 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:55370) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SCZqe-0001Jb-94 for control@debbugs.gnu.org; Tue, 27 Mar 2012 13:06:53 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1SCZMM-0000aP-PO for control@debbugs.gnu.org; Tue, 27 Mar 2012 12:35:03 -0400 Date: Tue, 27 Mar 2012 12:35:02 -0400 Message-Id: Subject: control message for bug 11090 To: X-Mailer: mail (GNU Mailutils 2.1) From: Glenn Morris X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) fixed 11090 24.2 From unknown Wed Jun 18 23:17:59 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 25 Apr 2012 11:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator