From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: akater Newsgroups: gmane.emacs.devel Subject: Re: Proposal: change indentation rules for one-dimensional lists in emacs-lisp-mode and lisp-mode Date: Fri, 01 May 2020 06:26:02 +0000 Message-ID: <87ees4xjb9.fsf@gmail.com> References: <87pnduz48f.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="123419"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier , Richard Stallman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri May 01 08:36:09 2020 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jUPHN-000W0j-5f for ged-emacs-devel@m.gmane-mx.org; Fri, 01 May 2020 08:36:09 +0200 Original-Received: from localhost ([::1]:50912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUPHM-0006d7-7c for ged-emacs-devel@m.gmane-mx.org; Fri, 01 May 2020 02:36:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:37888) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jUPGH-0004Fo-H1 for emacs-devel@gnu.org; Fri, 01 May 2020 02:35:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.90_1) (envelope-from ) id 1jUPGH-0003s3-3j for emacs-devel@gnu.org; Fri, 01 May 2020 02:35:01 -0400 Original-Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]:54377) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jUPGF-0003hM-LM; Fri, 01 May 2020 02:34:59 -0400 Original-Received: by mail-wm1-x342.google.com with SMTP id h4so4986332wmb.4; Thu, 30 Apr 2020 23:34:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=e3kPcO/GoNngpWfxQNlnnqTkGtRsoLeMC8+WQkiQzzs=; b=RgehAKhHLdoFMFknkW6LfjE2OzX5sniDzcs7qSIe8w5Nro8L4rjZA7qRaW37xJk9UH ELUEqANAPa4sTAymEptXHa4v0MZBBLzDXWr5jEhiNMbBK1HqwgEfqZ4WMGvRMqpygBny t9KtF5tWqeedMAK2kthe3/px8FZjZ0/TRF5lnaXXe0Gbag5IsAKuDrv4YuQ5IaUw9Z7Q /TapqE0Cio9JgWQA9WhoyawwJyWdK4aGQ/IDiNCq5dbFw9Jco5obqzUsO2nFIgLEVxMO JgWbnhNcxU2tNBMkeKt2OSYodH1WA+FDAy8Gwj/L8EZr6eyHeFrjumSLcKOryrBy4tV3 jQzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=e3kPcO/GoNngpWfxQNlnnqTkGtRsoLeMC8+WQkiQzzs=; b=FK479CcsO1k2H/LrWs767TNnfkK1kwR+O31H9jwp+t+DvwmbS3UsLR0YBx6CNkH5kB s5UPh8CtSrFrursIAKgEk9lgwLLTWHzxbj+1eXbLZE+DL0MWY8OozTebGMZ6cWB2SumA SQVaBGSRT9ABeCUGcNub9z1VQn9H4mRsIRu7+jJ7afy54u4FqURxl83gWQvmRRxuk7p7 pK1oBA0GFhwf1JTGSaRaDWmsvD2h0aDksyyUyZsPDX+XJj4f41ypbjLweg6R+jYAF9x1 ifGDRa98wKZxfFTXkn4zmFXRvQ7I3R8cULOglpZezibT24S2n+AL5Htqd3nEgmihoEQt Ww7g== X-Gm-Message-State: AGi0PubgASe09Mf71KM6j9gA4TwMebEMTSBHIUfTDkWBIlcQYCPitcUs qchX3Ii1iKMJTbERWzqUCv8= X-Google-Smtp-Source: APiQypKsa62UtzPU3gw2bmoRFhthMKy7re1kYtlI0iJ5LsMi/b0k4zOpDKhwmTyig8OkOE84tYKxDA== X-Received: by 2002:a1c:bd08:: with SMTP id n8mr2340917wmf.23.1588314897723; Thu, 30 Apr 2020 23:34:57 -0700 (PDT) Original-Received: from localhost ([185.220.102.6]) by smtp.googlemail.com with ESMTPSA id c190sm2734880wme.4.2020.04.30.23.34.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Apr 2020 23:34:57 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::342; envelope-from=nuclearspace@gmail.com; helo=mail-wm1-x342.google.com X-detected-operating-system: by eggs.gnu.org: Error: [-] PROGRAM ABORT : Malformed IPv6 address (bad octet value). Location : parse_addr6(), p0f-client.c:67 X-Received-From: 2a00:1450:4864:20::342 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:248296 Archived-At: FWIW, here's a patch that seems to work in emacs-lisp-mode but does not work in lisp-mode. It alters a single function, namely calculate-lisp-indent. I tested on various expressions; did try with paredit disabled. For now I'm baffled as to where the indentation procedures differ. I'll keep looking. --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -947,6 +947,7 @@ ;; setting this to a number inhibits calling hook (desired-indent nil) (retry t) + whitespace-after-open-paren calculate-lisp-indent-last-sexp containing-sexp) (cond ((or (markerp parse-start) (integerp parse-start)) (goto-char parse-start)) @@ -976,6 +977,7 @@ nil ;; Innermost containing sexp found (goto-char (1+ containing-sexp)) + (setq whitespace-after-open-paren (looking-at (rx whitespace))) (if (not calculate-lisp-indent-last-sexp) ;; indent-point immediately follows open paren. ;; Don't call hook. @@ -990,9 +992,11 @@ calculate-lisp-indent-last-sexp) ;; This is the first line to start within the containing sexp. ;; It's almost certainly a function call. - (if (= (point) calculate-lisp-indent-last-sexp) + (if (or (= (point) calculate-lisp-indent-last-sexp) + whitespace-after-open-paren) ;; Containing sexp has nothing before this line - ;; except the first element. Indent under that element. + ;; except the first element, or the first element is + ;; preceded by whitespace. Indent under that element. nil ;; Skip the first element, find start of second (the first ;; argument of the function call) and indent under.