From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Mekeor Melire Newsgroups: gmane.emacs.bugs Subject: bug#27507: [PATCH] Make `cycle-spacing' allow 'negative-zero in place of an integer Date: Sat, 01 Jul 2017 18:17:06 +0200 Message-ID: <87fuegdtdp.fsf@gmail.com> References: <87vanhpfpd.fsf@gmail.com> <87zicql0v5.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1498925897 8409 195.159.176.226 (1 Jul 2017 16:18:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 1 Jul 2017 16:18:17 +0000 (UTC) Cc: Mekeor Melire , 27507@debbugs.gnu.org To: npostavs@users.sourceforge.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jul 01 18:18:11 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 1dRL60-0001c2-Kv for geb-bug-gnu-emacs@m.gmane.org; Sat, 01 Jul 2017 18:18:08 +0200 Original-Received: from localhost ([::1]:55304 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dRL64-0001fO-3j for geb-bug-gnu-emacs@m.gmane.org; Sat, 01 Jul 2017 12:18:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:49336) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dRL5y-0001f8-Li for bug-gnu-emacs@gnu.org; Sat, 01 Jul 2017 12:18:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dRL5u-0001Fj-IZ for bug-gnu-emacs@gnu.org; Sat, 01 Jul 2017 12:18:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:45177) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dRL5u-0001FI-EG for bug-gnu-emacs@gnu.org; Sat, 01 Jul 2017 12:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1dRL5u-0001fD-3F for bug-gnu-emacs@gnu.org; Sat, 01 Jul 2017 12:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mekeor Melire Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Jul 2017 16:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 27507 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 27507-submit@debbugs.gnu.org id=B27507.14989258486354 (code B ref 27507); Sat, 01 Jul 2017 16:18:02 +0000 Original-Received: (at 27507) by debbugs.gnu.org; 1 Jul 2017 16:17:28 +0000 Original-Received: from localhost ([127.0.0.1]:47854 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRL5L-0001eQ-WD for submit@debbugs.gnu.org; Sat, 01 Jul 2017 12:17:28 -0400 Original-Received: from mail-wr0-f194.google.com ([209.85.128.194]:35008) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRL5K-0001eE-J6 for 27507@debbugs.gnu.org; Sat, 01 Jul 2017 12:17:26 -0400 Original-Received: by mail-wr0-f194.google.com with SMTP id z45so41486758wrb.2 for <27507@debbugs.gnu.org>; Sat, 01 Jul 2017 09:17:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=references:from:to:cc:subject:in-reply-to:date:message-id :mime-version; bh=h3Z9xj5UhrKJrUkjbt4LuhqbVAum6/P1sRPOtDIVMQI=; b=NPqHL90PHbc+KbkNWdDxOyyRz9e2AxrWJPkAHeCDcjC0zXLWlElQlkBt6cMRSAVjb+ dlqSRMb1XaYYSj8P1kCRpTD0ZwZXkThTbu/tV2VG97lEeKHBTwKAYYo9S5M6KaEk8b6a 61AosHiRNc/ABigG94c5itLdmTQBWMUQzkpxRqS0ugmPS4P0VFA/jP0EU7Tpbtla35qs TT58Q2HhdrB2mkXJawSiO99//BXeEzgwAHYQ9cXwniv+EUCmgfENhhz2LX4BNLSxp7Ie n6OE6IcGBwaJRk4B0+4ZIlhRbKBI1jOTRWra5uoFPcN+0N3E9MOG6xV6lP9OcB8KTFVE yRBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:from:to:cc:subject:in-reply-to:date :message-id:mime-version; bh=h3Z9xj5UhrKJrUkjbt4LuhqbVAum6/P1sRPOtDIVMQI=; b=IvdXTNoCQVURw4fGdYAnLE6TelvzEUQOaZmxIIzpUngo/fwaXC4Xwdq8jsLfhPocR5 GjdwlghoCJdS1uFiEwhfpyVL2z6YjEzg/xgMGtC6EFI1DXDZqgOND/q6ArH67k6gZ8c0 u+w43sokHoupgiSCB0aQ2WbHrchBZypanSqLp/duoILU5iY/EWrjLf/5s8WwfsgfRcSY JoaoTzsjZJ+il5sPxZV1YRquE78BCqR2GFrFbd4I3Xhk5KG8eDoIlMRxb8M9J+wbiTaU DF/N3M7wKRGvbUwZWADtfcc1bRaQCWWpBzQKgzuvPfgvefJknFMck79XuphDK2vO28sT ph4A== X-Gm-Message-State: AKS2vOxPubtN2qbdi8vuat0byGQJjfje/USad7DyCvbhB9Jf8CQdLUZ/ q5HPS3Te7YmbMLf/mvE= X-Received: by 10.223.146.195 with SMTP id 61mr15102946wrn.134.1498925840500; Sat, 01 Jul 2017 09:17:20 -0700 (PDT) Original-Received: from melibre. ([2001:a61:2267:eb01:6504:dc0:3542:fb2f]) by smtp.gmail.com with ESMTPSA id n71sm12709576wrb.62.2017.07.01.09.17.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 01 Jul 2017 09:17:19 -0700 (PDT) In-reply-to: <87zicql0v5.fsf@users.sourceforge.net> 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:134080 Archived-At: npostavs@users.sourceforge.net writes: > Mekeor Melire writes: >> * lisp/simple.el (cycle-spacing): beside accepting an integer as first >> argument N, also allow N to be 'negative-zero. This allows to delete >> all spaces including newlines with (cycle-spacing 'negative-zero). > This behaviour can't be used interactively right? If you want a > function to delete all space including newlines, I think it's better to > add one instead of adding yet another mode to cycle-spacing which won't > even be used by interactive callers. > That is, instead of (cycle-spacing 'negative-zero) something like > (delete-whitespace). Well, the point is that delete-whitespace would mostly have the same logic as cycle-spacing. So, should we define a more general function then, which both delete-whitespace and cycle-spacing would be based upon? So, currently `cycle-spacing' is used like this: (cycle-spacing &optional N PRESERVE-NL-BACK MODE) And the problem is that the sign(ature) of N is used to determine whether to delete newlines as well. So, if N is zero, we have a problem. So, I think we shouldn't use the signature of N but instead that should be another argument. But maybe let's use that new argument for a new function so that cycle-spacing stays backwardscompatible? So, I propose something like this: (defun (cycle-spacing &optional n preserve-nl-back mode) (cycle-spacing-general n preserve-nl-back (< n 0) mode)) (defun (cycle-spacing-general &optional n preserve-nl-back delete-newlines mode) ;; use (abs n) in place of n here ;; ... ) ;; this is optional: (defun (delete-whitespace &optional n preserve-n-back mode) (cycle-spacing-general n preserve-nl-back t mode)) >> + (letrec > > You only need let* here, I think. Uhm, I'm not sure. I'll check it out. Thanks for your feedback!