From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: npostavs@users.sourceforge.net Newsgroups: gmane.emacs.bugs Subject: bug#19740: 25.0.50; Bad comment indentation by `C-M-q' in `emacs-lisp-mode' Date: Wed, 14 Jun 2017 19:54:08 -0400 Message-ID: <878tkut9b3.fsf@users.sourceforge.net> References: <1580667c-4ee3-48b8-bbb7-cf6f41c36078@default> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: blaine.gmane.org 1497484393 5528 195.159.176.226 (14 Jun 2017 23:53:13 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 14 Jun 2017 23:53:13 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux) Cc: 19740@debbugs.gnu.org To: Drew Adams Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jun 15 01:53:08 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLI60-00018i-Eq for geb-bug-gnu-emacs@m.gmane.org; Thu, 15 Jun 2017 01:53:08 +0200 Original-Received: from localhost ([::1]:51263 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLI65-00019H-Ns for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 Jun 2017 19:53:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40385) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dLI5y-000198-W8 for bug-gnu-emacs@gnu.org; Wed, 14 Jun 2017 19:53:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dLI5u-0000dZ-4C for bug-gnu-emacs@gnu.org; Wed, 14 Jun 2017 19:53:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45433) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dLI5t-0000dT-UX for bug-gnu-emacs@gnu.org; Wed, 14 Jun 2017 19:53:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dLI5t-0000dO-OU for bug-gnu-emacs@gnu.org; Wed, 14 Jun 2017 19:53:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: npostavs@users.sourceforge.net Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 14 Jun 2017 23:53:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19740 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed patch Original-Received: via spool by 19740-submit@debbugs.gnu.org id=B19740.14974843622407 (code B ref 19740); Wed, 14 Jun 2017 23:53:01 +0000 Original-Received: (at 19740) by debbugs.gnu.org; 14 Jun 2017 23:52:42 +0000 Original-Received: from localhost ([127.0.0.1]:48110 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLI5Z-0000ck-KV for submit@debbugs.gnu.org; Wed, 14 Jun 2017 19:52:41 -0400 Original-Received: from mail-it0-f47.google.com ([209.85.214.47]:38487) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dLI5V-0000cM-PX; Wed, 14 Jun 2017 19:52:38 -0400 Original-Received: by mail-it0-f47.google.com with SMTP id l6so1757512iti.1; Wed, 14 Jun 2017 16:52:37 -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=VPwFJjukWvjbbXcvOU+UsBVYzVHv+wUtxLXQdNkteO4=; b=A/nIifi+5+AeIeOVuWhloLymmdk4aQSPQ7wQU/+UhQxFQKH40vMXvyPTEVh+bi0PUu wW1FerAXcBreZeLRWCDq7/+mhHwBd5mTT0MT8vUx+W/OgEUBbNCBEXdBE/dXD3y3FKG/ KrEs0zENsaM+tTkmiP/8Ne0QKg/FYvYhDV8EBns0n6eDHN2NwTEtbrRzvUOPGVQ4AOfF YsvFq/j3ZFgG8ymAYmSIS7lBU0bV3np+JYyay2sowUBHMX067//aw5KrMvLz3h+kyshj 5v2BRIzirVbQm4kYxaXKV+vF/E5G35YtMh1bm83bMWfeaw4MrWc1wvQW9Vhgw9Uf964j n9Gw== 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=VPwFJjukWvjbbXcvOU+UsBVYzVHv+wUtxLXQdNkteO4=; b=nY7MH0czEWWkilrkbspZMR9qIiB/ILcOKaNt8HMwLrvxj5Bv06QodPANNd4E2kYmMv D/TsNmSrV6ocijDIgvM6m6DB9pnlCp+guvi+89lA3feq9hYQ68HYuZJ7b4PLbWINxSCH FwyAUVPrlcYKfMYyzDqIBd2kUlnkXl0duyDTxhWowuoAoK0FsbGpNyLXFaE50DfWEaua VKW1YXhJ+ftznlwi6vrq7I0f1sAfFs+Konz5jlq/8nAV7yVL91ykN11ARN+TCh9IMKPa DG3e+O4CnJKPQgvHroxCgAjz8Z0b0/mGfg7ytfmWhPAzZcjvF9lyCzeOwZz11xfw8f0E v7/Q== X-Gm-Message-State: AKS2vOyiyO22rFTYRF0d/mJdrJr9NHi7t78Z0zgYPXT0fVwOSUy9hSE9 SxLDcusjnxfYDqtr X-Received: by 10.36.57.67 with SMTP id l64mr2668520ita.56.1497484351751; Wed, 14 Jun 2017 16:52:31 -0700 (PDT) Original-Received: from zony ([45.2.7.65]) by smtp.googlemail.com with ESMTPSA id m15sm716181iti.19.2017.06.14.16.52.30 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 14 Jun 2017 16:52:31 -0700 (PDT) In-Reply-To: <1580667c-4ee3-48b8-bbb7-cf6f41c36078@default> (Drew Adams's message of "Sat, 31 Jan 2015 20:19:34 -0800 (PST)") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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" Xref: news.gmane.org gmane.emacs.bugs:133592 Archived-At: --=-=-= Content-Type: text/plain # I accidentally tagged this bug instead of #385 before tags 385 + patch quit Drew Adams 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. It requires the patch I posted for #385. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=v1-0001-Don-t-put-whitespace-between-open-paren-and-comme.patch Content-Description: patch >From f314ec8ee3b99bb6adc5ee789ef07b8b834b5c57 Mon Sep 17 00:00:00 2001 From: Noam Postavsky Date: Wed, 14 Jun 2017 00:13:06 -0400 Subject: [PATCH v1] Don't put whitespace between open paren and comment in Lisp modes (Bug#19740) * lisp/emacs-lisp/lisp-mode.el (lisp-comment-indent): If current line's code ends in open paren, set comment indentation exactly to column following it. (lisp-mode-variables): Set `comment-indent-function' to `lisp-comment-indent'. --- lisp/emacs-lisp/lisp-mode.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 59db00d5f9..985b7513a3 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -602,6 +602,7 @@ (defun lisp-mode-variables (&optional lisp-syntax keywords-case-insensitive ;;(set (make-local-variable 'adaptive-fill-mode) nil) (setq-local indent-line-function 'lisp-indent-line) (setq-local indent-region-function 'lisp-indent-region) + (setq-local comment-indent-function #'lisp-comment-indent) (setq-local outline-regexp ";;;\\(;* [^ \t\n]\\|###autoload\\)\\|(") (setq-local outline-level 'lisp-outline-level) (setq-local add-log-current-defun-function #'lisp-current-defun-name) @@ -735,9 +736,15 @@ (defalias 'common-lisp-mode 'lisp-mode) (autoload 'lisp-eval-defun "inf-lisp" nil t) -;; May still be used by some external Lisp-mode variant. -(define-obsolete-function-alias 'lisp-comment-indent - 'comment-indent-default "22.1") +(defun lisp-comment-indent () + "Like `comment-indent-default', but don't put space after open paren." + (let ((pt (point))) + (skip-syntax-backward " ") + (if (eq (preceding-char) ?\() + (cons (current-column) (current-column)) + (goto-char pt) + (comment-indent-default)))) + (define-obsolete-function-alias 'lisp-mode-auto-fill 'do-auto-fill "23.1") (defcustom lisp-indent-offset nil -- 2.11.1 --=-=-= Content-Type: text/plain [1: bdbe3a8995]: 2000-09-29 19:11:42 +0000 (comment-indent-function): Use 0 for ;;; and %%%. (comment-indent): Make sure there's a space between code and comment[...] http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=bdbe3a8995c5f1dae126acd4be4872f6af687cd1 --=-=-=--