unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Phil Sainty <psainty@orcon.net.nz>
Cc: 2034@debbugs.gnu.org
Subject: bug#2034: [PATCH] 27.0.50; Support mode line constructs for `mode-name' in c-mode
Date: 4 Jul 2018 20:11:50 -0000	[thread overview]
Message-ID: <20180704201150.74826.qmail@mail.muc.de> (raw)
In-Reply-To: <mailman.3006.1530625089.1292.bug-gnu-emacs@gnu.org>

Hello, Phil.

In article <mailman.3006.1530625089.1292.bug-gnu-emacs@gnu.org> you wrote:
> On 03/07/18 10:53, Phil Sainty wrote:
>> I'll write a revised patch to address these points.

> An updated version is on branch origin/fix/bug-2034 with the
> following change log.


> Support mode line constructs for 'mode-name' in c-mode (bug#2034)

> Also make the inclusion of minor mode flags in 'mode-name' optional.

> * lisp/progmodes/cc-cmds.el (c-modeline-flags): New variable.
> (c-modeline-flags-major-modes-processed): New variable.
> (c-modeline-display-flags): New user option.
> (c-update-modeline): Use them.  Use mode line constructs, rather than
> string concatenation, to optionally include minor mode flags in
> 'mode-name'.

> * lisp/progmodes/cc-mode.el (c-submit-bug-report): Format 'mode-name'.

> * lisp/progmodes/cc-styles.el (c-set-style): Format 'mode-name'.

> * etc/NEWS: Mention new user option and behaviors.

> * doc/misc/cc-mode.texi: Document 'c-modeline-display-flags'.

For fitting in better with CC Mode, please:
(i) Put c-modeline-display-flags (and any other configuration variables)
in cc-vars.el rather than cc-cmds.el.
(ii) In cc-mode.info, make a second @vindex entry for your new variable,
like all the other variables have two @vindexes.

Also, in chapter "Minor Modes", I'd be happier if the paragraph
beginning "@ccmode{} displays the current state" was amended to
something like "@ccmode{}, by default, displays the current state".

But I must confess, I'm not filled with enthusiasm by this change.  What
is the problem it is fixing?  The original problem (use of a CC Mode
command by a non CC Mode mode) went away when cc-subword.el became just
subword-mode.

This change introduces complexity, even if, perhaps, not very much.  Do
we really need a buffer local variable for the display of these flags?
(That's a real question, not a rhetorical one.)  It seems to be inviting
misuse, given that it prevails for ever, but is really only valid for
the short time between it being calculated and the mode line being
displayed.

    +(defvar-local c-modeline-flags-major-modes-processed nil
    +  "Major modes for which `c-update-modeline' has processed `mode-name'.

.... seems confused.  It's a poor quality doc string, since it doesn't
say what the format is: is it a list of major modes, or a list of major
mode names, or what?  Why is this collection of major modes relevant to
a single buffer?  What's the purpose of the variable?

I'm rather sceptical about

    (setq mode-name (list mode-name .....

, which is just screaming out for an unbounded appending of other
things, many times over, if anything goes wrong with the enclosing
`unless' form.  What happens to it when the major mode is changed?
Would it not be possible, somehow, either to leave mode-name unmolested,
or calculate it unrecursively when needed?

As a final point, how is the backward compatibility of this change?  How
many former Emacsen will it work in?

-- 
Alan Mackenzie (Nuremberg, Germany).






  parent reply	other threads:[~2018-07-04 20:11 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8cbpgkqwkt.fsf@fencepost.gnu.org>
2009-01-25  2:10 ` bug#2034: 23.0.60; c-subword-mode incompatible with xml-mode me
2009-01-25 15:44   ` Stefan Monnier
2009-01-25 18:48     ` Ross Patterson
2010-01-23 22:36   ` bug#2034: marked as done (23.0.60; c-subword-mode incompatible with xml-mode) Emacs bug Tracking System
2018-07-02 12:40   ` bug#2034: [PATCH] 27.0.50; Support mode line constructs for `mode-name' in c-mode Phil Sainty
2018-07-02 15:29     ` Eli Zaretskii
2018-07-02 22:53       ` Phil Sainty
2018-07-03 13:37         ` Phil Sainty
2018-07-04  2:41         ` Eli Zaretskii
     [not found]   ` <mailman.3006.1530625089.1292.bug-gnu-emacs@gnu.org>
2018-07-04 20:11     ` Alan Mackenzie [this message]
2018-07-04 21:13       ` Phil Sainty
2018-07-08  2:46         ` Phil Sainty
2018-07-08 20:08         ` Alan Mackenzie
2018-07-09 14:47           ` Phil Sainty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180704201150.74826.qmail@mail.muc.de \
    --to=acm@muc.de \
    --cc=2034@debbugs.gnu.org \
    --cc=psainty@orcon.net.nz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).