From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philipp Haselwarter Newsgroups: gmane.emacs.bugs Subject: bug#11090: 24.0.94; Allow customization of inline-comment offset Date: Sun, 25 Mar 2012 18:52:35 +0200 Message-ID: <87ehsgmxm4.fsf@nzebook.haselwarter.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="Skipjack/asset/computer-terrorism/White-Water/xncJ2WzDoi" X-Trace: dough.gmane.org 1332694446 7958 80.91.229.3 (25 Mar 2012 16:54:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 25 Mar 2012 16:54:06 +0000 (UTC) To: 11090@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Mar 25 18:54:05 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SBqhh-0004c0-76 for geb-bug-gnu-emacs@m.gmane.org; Sun, 25 Mar 2012 18:54:05 +0200 Original-Received: from localhost ([::1]:43069 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SBqhe-00049Z-G5 for geb-bug-gnu-emacs@m.gmane.org; Sun, 25 Mar 2012 12:54:02 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:49341) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SBqhb-00049O-Fu for bug-gnu-emacs@gnu.org; Sun, 25 Mar 2012 12:54:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SBqhZ-00072R-HT for bug-gnu-emacs@gnu.org; Sun, 25 Mar 2012 12:53:59 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59858) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SBqhZ-00072M-EF for bug-gnu-emacs@gnu.org; Sun, 25 Mar 2012 12:53:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SBrBd-0007S7-OF for bug-gnu-emacs@gnu.org; Sun, 25 Mar 2012 13:25:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Haselwarter Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 25 Mar 2012 17:25:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 11090 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.133269625128586 (code B ref -1); Sun, 25 Mar 2012 17:25:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 25 Mar 2012 17:24:11 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-Received: (qmail invoked by alias); 25 Mar 2012 16:52:37 -0000 Original-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 X-NSA-Fodder: Rand Corporation Sundevil Syria AMW espionage PET Defcon argus 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:58131 Archived-At: --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--