From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: joaotavora@gmail.com (=?utf-8?B?Sm/Do28gVMOhdm9yYQ==?=) Newsgroups: gmane.emacs.devel Subject: Re: PATCH: make linum.el play nicely with other margin-setting extensions Date: Sun, 15 Nov 2015 14:19:59 +0000 Message-ID: References: <83vb97i3ta.fsf@gnu.org> <83k2pldksq.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1447657535 18906 80.91.229.3 (16 Nov 2015 07:05:35 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 16 Nov 2015 07:05:35 +0000 (UTC) Cc: markus.triska@gmx.at, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Nov 16 08:05:29 2015 Return-path: Envelope-to: ged-emacs-devel@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 1ZyDqx-0000qR-6O for ged-emacs-devel@m.gmane.org; Mon, 16 Nov 2015 08:05:27 +0100 Original-Received: from localhost ([::1]:46332 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZyDqw-0007mF-Im for ged-emacs-devel@m.gmane.org; Mon, 16 Nov 2015 02:05:26 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41603) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zxy9x-0000b1-De for emacs-devel@gnu.org; Sun, 15 Nov 2015 09:20:02 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zxy9u-0005n6-5H for emacs-devel@gnu.org; Sun, 15 Nov 2015 09:20:01 -0500 Original-Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:36374) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zxy9t-0005n1-VA; Sun, 15 Nov 2015 09:19:58 -0500 Original-Received: by wmww144 with SMTP id w144so80483974wmw.1; Sun, 15 Nov 2015 06:19:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type:content-transfer-encoding; bh=fIs3N3Z260OkfF4QSFsHrzIeTDg7Ug9n64i6yo8gaNI=; b=PLYTIK8baqV5ZgQQeByj/0R0ls/XTIpyp1kc3QcRrQoW0NLBEoez7tCuaiPidIM0We D60kyhBRChtX6587SQMpQYNslAKqlTxl4GdoLYGjfvV7VIoEb4RdQjKj2kVcUXP5eRIW zKZmI8BFwZykxppca/PwzVhu2g6cl5CeB/sYRmNFL9utB4dX9MMo3Syd/wu3xp/hTTnz Bb0SxXVXgKOSorPuyvP2/96/cVXULMmxEyvsE1coPA3XYzspYLfjGUuTj8/QSAcB99JV gg+FMNDcDSa6/o3nejXmQw7oIlWe6qg0c1bgdyUmVR4xL/vnQRn7n3jtYN/kGjrhYq1B CIXQ== X-Received: by 10.28.138.148 with SMTP id m142mr14599845wmd.2.1447597197318; Sun, 15 Nov 2015 06:19:57 -0800 (PST) Original-Received: from king.yourcompany.com (31.57.37.188.rev.vodafone.pt. [188.37.57.31]) by smtp.gmail.com with ESMTPSA id u4sm23268649wjz.4.2015.11.15.06.19.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 15 Nov 2015 06:19:55 -0800 (PST) In-Reply-To: <83k2pldksq.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 14 Nov 2015 10:53:09 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (darwin) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c09::232 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:194522 Archived-At: Eli Zaretskii writes: >> From: joaotavora@gmail.com (Jo=C3=A3o T=C3=A1vora) >> Date: Fri, 13 Nov 2015 08:32:57 +0000 >> Cc: markus.triska@gmx.at, emacs-devel@gnu.org >>=20 >> linum.el uses the left margin to make just enough to show numbered >> indicators. The gist of this patch is: if there is enough space there >> already, linum.el won't set the left margin width. >>=20 >> But if it does, it records that fact in a window parameter, to check >> later, when turning off linum-mode, if resetting the margin is >> needed. In this situation, resetting the margin is only needed if >> linum-mode was the only extension to touch it, otherwise one considers >> that some other extension or interactive "set-margins" call touched the >> margins. >>=20 >> The way I implemented "some other extension ... touched the margins" is >> an equal test of current margins vs remembered set margins. >>=20 >> It seems robust enough for now, but ideally linum-mode would know that >> "his" margins have been overriden interactively or by some other >> extension, and decide in accordance. > > Thanks for the explanations. Could you please look at nlinum.el (in > ELPA) and see whether its solution to this problem is better, or at > least not worse, and satisfies the needs of darkroom-mode? If so, I'd > rather we adopted the nlinum solution in linum as well. > Just did that. It's Stefan's commit 77c062f41bfe20d5a7a259beeda1c2a26b95f5d0 to elpa.git (curiously not included in the freshly package-install'ed nlinum.el, but maybe that's intentional). It seems basically the same thing as the patch I originally proposed, only Stefan's a bit more convoluted, so perhaps I'm not reading it correctly. Anyway, I say it's "basically the same"" because both patches fail in the following situation. The reason is that nlinum.el is not as "noisy" as linum.el (as Martin noticed elsewhere in this thread): M-x nlinum-mode ;; good, line numbers M-x darkroom-mode ;; good, line-numbers + darkroom margins M-x darkroom-mode ;; oops, no line-numbers OR darkroom margins, even ;; after a bit of scrolling (linum works here) C-x 2 ;; change the window configuration, or force ;; nlinum--setup-window somehow, and line-numbers ;; restored Also notice Stefan's comment - ;; FIXME: The interaction between different uses of the margin is - ;; problematic. We should have a way for different packages to indicate= (and - ;; change) their preference independently. Meaning that we do need to find a way to p *both* nlinum.el and darkroom.el to use some kind of ownership-awareness scheme. I'm discussing such a scheme with Martin (and Juanma).=20 Jo=C3=A3o