From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Advice needed on modeline customization hack... Date: Sat, 15 Apr 2017 23:11:28 -0400 Message-ID: References: <20170415212800.5be89037@jabberwock.cb.piermont.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1492312343 20846 195.159.176.226 (16 Apr 2017 03:12:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 16 Apr 2017 03:12:23 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 16 05:12:20 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 1czabr-0005B5-Jy for ged-emacs-devel@m.gmane.org; Sun, 16 Apr 2017 05:12:19 +0200 Original-Received: from localhost ([::1]:58931 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1czabq-0000Q7-JP for ged-emacs-devel@m.gmane.org; Sat, 15 Apr 2017 23:12:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1czabG-0000Q2-41 for emacs-devel@gnu.org; Sat, 15 Apr 2017 23:11:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1czabD-000872-06 for emacs-devel@gnu.org; Sat, 15 Apr 2017 23:11:42 -0400 Original-Received: from [195.159.176.226] (port=52938 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1czabC-000867-Pn for emacs-devel@gnu.org; Sat, 15 Apr 2017 23:11:38 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1czab3-0004Ez-Oh for emacs-devel@gnu.org; Sun, 16 Apr 2017 05:11:29 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 27 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:WkcynHlil3L/o8WstZwN5IzNTio= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 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:213987 Archived-At: > So I have been irritated for a while by the fact that when you turn > on column-number-mode, that the displayed column starts at zero. GNU > coding standards say that compilers and the like are to spit out error > messages with column numbers starting at one, so what your modeline > tells you and what your error message tells you are off by one. FWIW there are other discrepancies in this area. Some programs report error's column number in terms of "bytes", others in terms of "chars", and yet others in terms of "display columns" (e.g. counting TAB as something like 8 spaces). So there should be room for more customizability. > 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. I suggest adding a function `mode-line-substitute` which traverses the mode-line-format looking for particular elements to replace with something else. So the user can do something like (mode-line-substitute "%c" "%C") Stefan