From unknown Sun Jun 22 07:58:56 2025 X-Loop: help-debbugs@gnu.org Subject: bug#6141: 23.2; comment-choose-indent does the wrong thing Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 08 May 2010 16:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6141 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 6141@debbugs.gnu.org X-Debbugs-Original-To: Received: via spool by submit@debbugs.gnu.org id=B.127333757010790 (code B ref -1); Sat, 08 May 2010 16:53:01 +0000 Received: (at submit) by debbugs.gnu.org; 8 May 2010 16:52:50 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OAnGj-0002nz-Lv for submit@debbugs.gnu.org; Sat, 08 May 2010 12:52:50 -0400 Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OAnGh-0002nu-Fo for submit@debbugs.gnu.org; Sat, 08 May 2010 12:52:47 -0400 Received: from lists.gnu.org ([199.232.76.165]:51624) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OAnGi-0003Nh-1F for submit@debbugs.gnu.org; Sat, 08 May 2010 12:52:48 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1OAnGh-0005ha-BP for bug-gnu-emacs@gnu.org; Sat, 08 May 2010 12:52:47 -0400 Received: from [140.186.70.92] (port=56173 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OAnGf-0005hS-3J for bug-gnu-emacs@gnu.org; Sat, 08 May 2010 12:52:46 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OAnGd-0006lT-BH for bug-gnu-emacs@gnu.org; Sat, 08 May 2010 12:52:44 -0400 Received: from rcsinet10.oracle.com ([148.87.113.121]:54924) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OAnGc-0006kz-7E for bug-gnu-emacs@gnu.org; Sat, 08 May 2010 12:52:43 -0400 Received: from rcsinet13.oracle.com (rcsinet13.oracle.com [148.87.113.125]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o48GqdxZ032240 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 8 May 2010 16:52:41 GMT Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by rcsinet13.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o487Pehn013859 for ; Sat, 8 May 2010 16:52:39 GMT Received: from abhmt021.oracle.com by acsmt353.oracle.com with ESMTP id 224977551273337557; Sat, 08 May 2010 09:52:37 -0700 Received: from dradamslap1 (/10.175.229.69) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 08 May 2010 09:52:37 -0700 From: "Drew Adams" Date: Sat, 8 May 2010 09:52:38 -0700 Message-ID: <05022FFFFF0A4CB5A9568BD72D554BA9@us.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 11 Thread-Index: Acruzt2qnNKW1DtQTNGmH/KomkbK2g== X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Auth-Type: Internal IP X-Source-IP: rcsinet13.oracle.com [148.87.113.125] X-CT-RefId: str=0001.0A090204.4BE596D9.0049:SCFMA4539811,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Spam-Score: -4.8 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 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.1 (------) Put the cursor on the first comment line in this defun and hit M-;. The comment is moved one space to the right. It should not be moved at all. (defun foo (zz) "..." (let (;; (xx xx) ;; (ww ww) (mm mm)) toto)) `comment-choose-indent' is the problematic code. It is called with arg INDENT = 0 in this case The doc string of `comment-choose-indent', which is the problematic code, even says that the code should try to align with surrounding comments, and that it should prefer INDENT: "Choose the indentation to use for a right-hand-side comment. The criteria are (in this order): - try to keep the comment's text within `comment-fill-column'. - try to align with surrounding comments. - prefer INDENT (or `comment-column' if nil). Point is expected to be at the start of the comment." The problem comes from the systematic (1+ (current-column)), which sets the minimum (variable MIN) to one more than the current column. See also this comment: ;; Can't align to a previous comment: let's try to align to comments ;; on the following lines, then. These have not been re-indented yet, ;; so we can't directly align ourselves with them. All we do is to try ;; and choose an indentation point with which they will be able to ;; align themselves. The assumption that the following comment lines have not been correctly indented is incorrect in this case. `comment-choose-indent' should not be assuming anything about "re-indenting" - it is for _caller_ functions to deal with any re-indenting that might take place on other lines than the current one. `comment-choose-indent' does not do any "re-indenting". It does not even do any indenting. It simply returns a computed possible indent value for code that might want to indent or re-indent. This bug exists since Emacs 21, BTW. Emacs 20 does the right thing in this case. In GNU Emacs 23.2.1 (i386-mingw-nt5.1.2600) of 2010-05-08 on G41R2F1 Windowing system distributor `Microsoft Corp.', version 5.1.2600 configured using `configure --with-gcc (3.4) --no-opt --cflags -Ic:/xpm/include' From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 10 02:38:53 2014 Received: (at control) by debbugs.gnu.org; 10 Feb 2014 07:38:53 +0000 Received: from localhost ([127.0.0.1]:33897 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WClS7-0003Zq-WA for submit@debbugs.gnu.org; Mon, 10 Feb 2014 02:38:52 -0500 Received: from hermes.netfonds.no ([80.91.224.195]:38924) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1WClS4-0003Zf-LU for control@debbugs.gnu.org; Mon, 10 Feb 2014 02:38:49 -0500 Received: from [204.14.154.233] (helo=building.gnus.org) by hermes.netfonds.no with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from ) id 1WClRp-0000lS-OR for control@debbugs.gnu.org; Mon, 10 Feb 2014 08:38:34 +0100 Date: Sun, 09 Feb 2014 23:37:20 -0800 Message-Id: <87d2iv1kr3.fsf@building.gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #6141 X-MailScanner-ID: 1WClRp-0000lS-OR X-Netfonds-MailScanner: Found to be clean X-Netfonds-MailScanner-From: larsi@gnus.org MailScanner-NULL-Check: 1392622715.00133@RtQgoknMQvmKpw8X33X8gg X-Spam-Status: No X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) tags 6141 confirmed From debbugs-submit-bounces@debbugs.gnu.org Sat Apr 30 13:07:46 2016 Received: (at control) by debbugs.gnu.org; 30 Apr 2016 17:07:46 +0000 Received: from localhost ([127.0.0.1]:58181 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1awYMs-0001GW-0V for submit@debbugs.gnu.org; Sat, 30 Apr 2016 13:07:46 -0400 Received: from hermes.netfonds.no ([80.91.224.195]:58711) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1awYMq-0001GP-QU for control@debbugs.gnu.org; Sat, 30 Apr 2016 13:07:45 -0400 Received: from cm-84.215.1.64.getinternet.no ([84.215.1.64] helo=mouse) by hermes.netfonds.no with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1awYMo-0004gg-Kw for control@debbugs.gnu.org; Sat, 30 Apr 2016 19:07:44 +0200 Date: Sat, 30 Apr 2016 19:07:42 +0200 Message-Id: <877fffgh41.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #19740 X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) forcemerge 19740 6141 From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 14 00:31:37 2017 Received: (at control) by debbugs.gnu.org; 14 Jun 2017 04:31:37 +0000 Received: from localhost ([127.0.0.1]:46534 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKzxw-00087K-ON for submit@debbugs.gnu.org; Wed, 14 Jun 2017 00:31:37 -0400 Received: from mail-it0-f43.google.com ([209.85.214.43]:38781) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dKzxv-000873-5Z; Wed, 14 Jun 2017 00:31:35 -0400 Received: by mail-it0-f43.google.com with SMTP id l6so40953502iti.1; Tue, 13 Jun 2017 21:31:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=Q99BLSFz68Huot7NQ3KMfLGnBPBgsJo1qwbSFZQfQAw=; b=QC2fT9YUZ675rCP8O59lhfb32aKHq7vkU1abqp0s3nowKNjUQQQ4cLd5xz8QpcJgZ8 9azetNPwGtVMTDFQYru1lzDUitJeZx70Wgq5uQ6N4Uavl7lOB0XT19kjaRG9kFYNMd25 IKllHS3wlQzXpJ4Zyt8xOw9NxHieXN0nDYHLIujUWY3rcuAV6MuiSLp6OX2mX+V94+9z 7e42qrMfRKSPq8yzEB2TvUdMYx2ZoNEukZVw/Eh1qN7cXIsKqu7VjDe3smVJ8+ppGGaI KPOQjkGnLo6dPYKTKiK++8dGLa0fqNFL0WTxpOLEo62xg5JPqeOwE2JQmz1xUBctNft2 OqlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=Q99BLSFz68Huot7NQ3KMfLGnBPBgsJo1qwbSFZQfQAw=; b=qB82slgDXrbZHHOTkwzJz8iJzJzdtzD2PXdR5SQYWdM2/OCIIMCNMNhqiFwOINzxWM TVp3jJM7tJW++KmpZ46ACvrquwO2Cu5cYmuTt525okiXxiqznmoUqikVZkxoYXWreFqa 0uU3lyAKTorFverlMMBzmVX8jVgGH7NO13WPIMaebBoXIxCT0M71Trh3Skgb1npEr6a9 SGoNHmz2Xt71nRKtU7UmiifE/3VRdtMWYpWUSy9MtDkn718UnAlR5PlLmSMQ87IiStMa vKfwdWw9vW0CPho28XCwfNpve11ydy7Z6eNslF3BCBKhJtgESOpBMvB4z226rhOtYqch Ntbg== X-Gm-Message-State: AKS2vOyZ7Uf09kpI7m2czdtOtX5UAx9dHjV4na+mDVjsAR8JDFth3uJp 2uw4WRbY4buFaHvB X-Received: by 10.36.11.68 with SMTP id 65mr4247282itd.80.1497414689357; Tue, 13 Jun 2017 21:31:29 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id o14sm82120itb.8.2017.06.13.21.31.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 13 Jun 2017 21:31:27 -0700 (PDT) From: npostavs@users.sourceforge.net To: Stefan Monnier Subject: Re: bug#385: [PATCH] comment-indent doesn't respect comment-indent-function References: <20080611171102.7261.qmail@byte.local> Date: Wed, 14 Jun 2017 00:33:06 -0400 In-Reply-To: (Stefan Monnier's message of "Wed, 11 Jun 2008 14:04:57 -0400") Message-ID: <87efuntchp.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: control Cc: 385@debbugs.gnu.org, "Christopher J. Madsen" X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) --=-=-= Content-Type: text/plain tags 19740 + patch block 19740 by 385 quit Stefan Monnier writes: > If you need more control over the placement, rather than a variable > comment-indent-fixed, maybe we should just say that if > comment-indent-function returns a list of a single integer, it should be > taken as the indentation position and not second-guessed. Or it could > return a cons cell (MIN . MAX) to say "anywhere between MIN and MAX". Here's a patch. This seems to be a prerequisite to fix #19740. Regarding incompatibility of new comment-indent-functions for old Emacs, some simple advice on comment-choose-indent should easily do the trick. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Allow-comment-indent-functions-to-specify-exact-i.patch Content-Description: patch >From cc9db0dbb5590ee909386078128e55c5ee24f319 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Wed, 14 Jun 2017 00:08:15 -0400 Subject: [PATCH v1] Allow comment-indent-functions to specify exact indentation (Bug#385) * lisp/newcomment.el (comment-choose-indent): Interpret a cons of two integers as indicating a range of acceptable indentation. (comment-indent): Don't apply `comment-inline-offset', `comment-choose-indent' already does that. (comment-indent-function): * doc/emacs/programs.texi (Options for Comments): Document new acceptable return values. * etc/NEWS: Announce it. --- doc/emacs/programs.texi | 9 ++++++--- etc/NEWS | 4 ++++ lisp/newcomment.el | 35 ++++++++++++++++++----------------- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi index 222d1c2a4d..27ac0eb640 100644 --- a/doc/emacs/programs.texi +++ b/doc/emacs/programs.texi @@ -1146,9 +1146,12 @@ Options for Comments various major modes. The function is called with no arguments, but with point at the beginning of the comment, or at the end of a line if a new comment is to be inserted. It should return the column in which the -comment ought to start. For example, in Lisp mode, the indent hook -function bases its decision on how many semicolons begin an existing -comment, and on the code in the preceding lines. +comment ought to start. For example, the default hook function bases +its decision on how many comment characters begin an existing comment. + +Emacs also tries to align comments on adjacent lines. To override +this, the function may return a cons of two (possibly equal) integers +to indicate an acceptable range of indentation. @node Documentation @section Documentation Lookup diff --git a/etc/NEWS b/etc/NEWS index 7e955ad26d..2467e81fe3 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -377,6 +377,10 @@ display of raw bytes from octal to hex. ** You can now provide explicit field numbers in format specifiers. For example, '(format "%2$s %1$s" "X" "Y")' produces "Y X". ++++ +** 'comment-indent-function' values may now return a cons to specify a +range of indentation. + * Editing Changes in Emacs 26.1 diff --git a/lisp/newcomment.el b/lisp/newcomment.el index 118549f421..8772b52376 100644 --- a/lisp/newcomment.el +++ b/lisp/newcomment.el @@ -142,9 +142,10 @@ (put 'comment-end 'safe-local-variable 'stringp) ;;;###autoload (defvar comment-indent-function 'comment-indent-default "Function to compute desired indentation for a comment. -This function is called with no args with point at the beginning of -the comment's starting delimiter and should return either the desired -column indentation or nil. +This function is called with no args with point at the beginning +of the comment's starting delimiter and should return either the +desired column indentation, a range of acceptable +indentation (MIN . MAX), or nil. If nil is returned, indentation is delegated to `indent-according-to-mode'.") ;;;###autoload @@ -649,13 +650,20 @@ (defun comment-choose-indent (&optional indent) - prefer INDENT (or `comment-column' if nil). Point is expected to be at the start of the comment." (unless indent (setq indent comment-column)) - ;; Avoid moving comments past the fill-column. - (let ((max (+ (current-column) - (- (or comment-fill-column fill-column) - (save-excursion (end-of-line) (current-column))))) - (other nil) - (min (save-excursion (skip-chars-backward " \t") - (if (bolp) 0 (+ comment-inline-offset (current-column)))))) + (let ((other nil) + min max) + (pcase indent + (`(,lo . ,hi) (setq min lo) (setq max hi) + (setq indent comment-column)) + (_ ;; Avoid moving comments past the fill-column. + (setq max (+ (current-column) + (- (or comment-fill-column fill-column) + (save-excursion (end-of-line) (current-column))))) + (setq min (save-excursion + (skip-chars-backward " \t") + ;; Leave at least `comment-inline-offset' space after + ;; other nonwhite text on the line. + (if (bolp) 0 (+ comment-inline-offset (current-column))))))) ;; Fix up the range. (if (< max min) (setq max min)) ;; Don't move past the fill column. @@ -750,13 +758,6 @@ (defun comment-indent (&optional continue) ;; If the comment is at the right of code, adjust the indentation. (unless (save-excursion (skip-chars-backward " \t") (bolp)) (setq indent (comment-choose-indent indent))) - ;; Update INDENT to leave at least one space - ;; after other nonwhite text on the line. - (save-excursion - (skip-chars-backward " \t") - (unless (bolp) - (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))) -- 2.11.1 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 05 22:58:35 2017 Received: (at control) by debbugs.gnu.org; 6 Jul 2017 02:58:35 +0000 Received: from localhost ([127.0.0.1]:54002 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSwzz-0000YQ-73 for submit@debbugs.gnu.org; Wed, 05 Jul 2017 22:58:35 -0400 Received: from mail-it0-f51.google.com ([209.85.214.51]:38708) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dSwzx-0000YB-PR; Wed, 05 Jul 2017 22:58:34 -0400 Received: by mail-it0-f51.google.com with SMTP id k192so104546029ith.1; Wed, 05 Jul 2017 19:58:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=aY+As/l+JK2oxKMMvb/JIRJtFmT9cYwNskndwAag8z0=; b=Y0pGcPEyBvM6/4mu4LF2eUftBstuF5n3/JvCETNPvBwk7rCQFNJY10Xv7GbjRmXQoa G1M1UuwW3PDSlR76yh5uI/D6sZThomfkdHg+UWps9o+baLDMxqOTgqYjM/Nin9I6fRgE X0QonXOMrpoSQAawzAuTockWWUfgnh36Jvymy+wBJ4AVgA3hXWTx8sQXsvQUsVvaQRul y8vz3VOAHYWIkas/RkGJXc2Lc5a40GVR+yD3WoHrAx1Xo4tH2WVDh9h12+9lQkxXE4iI AtnHHOvFYGVj6fbfSelHoR5uwbufMRdzk5Husa8NkwzauKMZ+KYrEoWhDS6B5tbevypO 2YSQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=aY+As/l+JK2oxKMMvb/JIRJtFmT9cYwNskndwAag8z0=; b=iYyAZz8kFpvEjcg7MDw/XWkdLCGCBu/2gbnj/gMiPEQREpqI1c2QewDngX+GKNX3RI MUcSSanlekfWwCEkmExUHlvRB7IL6EcPhw4naVmm72MFUvkPsxPSRACWlxa/p2pRrEpW kOAG2GPuDMPfUn9ESE0G8nxkVPyxEKyPNXTYTSorleR3BO+2NnsmfdmB9QudzNbz9sS9 mcshB6f0t8D3BlP+k33NxAD0jm7fXGBc4UVgdUzSqR9j9xpBONEeeWJDQblN2UQ4/klY lngR45yrqcMVD/fif5+9Mr3Psvl5GbwLk34rK8ZjeZ3zkiyMd7X4MZlQ/UfgW+FwWrg+ xgfg== X-Gm-Message-State: AKS2vOzcFkL0EeYKkrJwH9KVHqBCns+iufGg2TqEpVwbA4S2mYSI9UhF 2hw58IlgVSPPiKkb X-Received: by 10.107.201.66 with SMTP id z63mr46758883iof.220.1499309908188; Wed, 05 Jul 2017 19:58:28 -0700 (PDT) Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id s135sm13963399ita.2.2017.07.05.19.58.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 05 Jul 2017 19:58:27 -0700 (PDT) From: npostavs@users.sourceforge.net To: Drew Adams Subject: Re: bug#19740: 25.0.50; Bad comment indentation by `C-M-q' in `emacs-lisp-mode' References: <1580667c-4ee3-48b8-bbb7-cf6f41c36078@default> <878tkut9b3.fsf@users.sourceforge.net> Date: Wed, 05 Jul 2017 23:00:03 -0400 In-Reply-To: <878tkut9b3.fsf@users.sourceforge.net> (npostavs@users.sourceforge.net's message of "Wed, 14 Jun 2017 19:54:08 -0400") Message-ID: <87lgo2gtho.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: control Cc: 19740@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) tags 19740 fixed close 19740 26.1 quit npostavs@users.sourceforge.net writes: >> This is a regression introduced after Emacs 20 (perhaps after 21). >> >> Emacs should not indent the first `;;' comment line here by a space. >> That does no good and interferes with alignment of a multi-line >> comments and multiple separate comments that are on the same level. >> >> (let* ( ;; If FOOBAR then blah the blahdy blah and other blahs if blah, >> ;; blah, or blah. Unless, that is, blah, blah, or blah. >> (the-tatas (bar-bar-toto-babar foo1 foo2 foo3)) >> ...) >> >> In Emacs 20, this is the result - no extra space inserted. The two >> comment lines, which are logically at the same level, and in this case >> are part of a single multi-line comment, are aligned vertically. >> >> (let* (;; If FOOBAR then blah the blahdy blah and other blahs if blah, >> ;; blah, or blah. Unless, that is, blah, blah, or blah. >> (the-tatas (bar-bar-toto-babar foo1 foo2 foo3)) >> ...) > > > This was introduced in [1: bdbe3a8995]. I think in most contexts, it > makes sense to put the space, but it definitely looks wrong in a lisp > let. Here's patch to override the alignment for comments following an > open in paren in lisp modes. Pushed: [2: 7a0170de20] [2: 7a0170de20]: 2017-07-05 22:52:36 -0400 Don't put whitespace between open paren and comment in Lisp modes (Bug#19740) http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=7a0170de20fe1225d3eeac099d1e61a0c0410bf3