From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: "Perry E. Metzger" Newsgroups: gmane.emacs.devel Subject: Re: Advice needed on modeline customization hack... Date: Sat, 15 Apr 2017 21:55:29 -0400 Message-ID: <20170415215529.40ad1ef1@jabberwock.cb.piermont.com> References: <20170415212800.5be89037@jabberwock.cb.piermont.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1492307736 23584 195.159.176.226 (16 Apr 2017 01:55:36 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 16 Apr 2017 01:55:36 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 16 03:55:31 2017 Return-path: Envelope-to: ged-emacs-devel@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 1czZPX-000608-3A for ged-emacs-devel@m.gmane.org; Sun, 16 Apr 2017 03:55:31 +0200 Original-Received: from localhost ([::1]:58606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1czZPc-0006IR-Np for ged-emacs-devel@m.gmane.org; Sat, 15 Apr 2017 21:55:36 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1czZPX-0006IL-7j for emacs-devel@gnu.org; Sat, 15 Apr 2017 21:55:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1czZPW-0000zn-Ft for emacs-devel@gnu.org; Sat, 15 Apr 2017 21:55:31 -0400 Original-Received: from hacklheber.piermont.com ([2001:470:30:84:e276:63ff:fe62:3400]:49937) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1czZPW-0000zK-CL for emacs-devel@gnu.org; Sat, 15 Apr 2017 21:55:30 -0400 Original-Received: from snark.cb.piermont.com (localhost [127.0.0.1]) by hacklheber.piermont.com (Postfix) with ESMTP id 7D740213 for ; Sat, 15 Apr 2017 21:55:29 -0400 (EDT) Original-Received: from jabberwock.cb.piermont.com (jabberwock.cb.piermont.com [10.160.2.107]) by snark.cb.piermont.com (Postfix) with ESMTP id 6501D2DE040 for ; Sat, 15 Apr 2017 21:55:29 -0400 (EDT) In-Reply-To: <20170415212800.5be89037@jabberwock.cb.piermont.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:470:30:84:e276:63ff:fe62:3400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:213984 Archived-At: On Sat, 15 Apr 2017 21:28:00 -0400 "Perry E. Metzger" wrote: > The two line patch at the end of this adds a %C modeline construct > that acts just like %c only it displays the modeline with characters > starting at 1 instead of zero. Doing it that way gives you > essentially no extra performance hit. That part turns out to be the > easy bit. > > Harder is this: short of redefining the entirety of the really, > really long mode-line-position variable from bindings.el, which > isn't something one wants to tell people to casually do in > their .emacs (it's long and complicated as heck), I'm not quite > sure how to do a practical customization here. Then again, I only > half understand how the modeline format stuff works at all, and it > seems semantically rich enough that some reasonable way to do this > should exist. > > Advice on how to do the elisp half of this so there can be an easy > setting to let you pick one based or zero based? So, partially answering my own question, it seems like the only obvious way to do this is to add yet another foo-mode variable and a bunch of lines to the definition of mode-line-position in bindings.el that do exactly what the current ones do for when column-number-mode is set, only selecting between using %c and %C in the constructs. This seems a little gross, but I'm not really sure what else is practical. Assuming this is the right thing, advice on what to call this new (very) minor mode are solicited. Perry -- Perry E. Metzger perry@piermont.com