* c-update-modeline format for c-block-comment-flag
@ 2017-10-13 10:24 Andy Moreton
2017-10-13 12:24 ` Eli Zaretskii
2017-10-13 14:45 ` Alan Mackenzie
0 siblings, 2 replies; 6+ messages in thread
From: Andy Moreton @ 2017-10-13 10:24 UTC (permalink / raw)
To: emacs-devel
Hi,
The handling of c-block-comment-flag in c-update-modeline is
unfortunate:
(defun c-update-modeline ()
(let ((fmt (format "/%s%s%s%s%s"
(if c-block-comment-flag "*" "/")
(if c-electric-flag "l" "")
(if (and c-electric-flag c-auto-newline)
"a" "")
(if c-hungry-delete-key "h" "")
(if (and
;; (cc-)subword might not be loaded.
(boundp 'c-subword-mode)
(symbol-value 'c-subword-mode))
;; FIXME: subword-mode already comes with its
;; own lighter!
"w"
"")))
This fixed "/" in the modeline string forces this submode lighter to be
always present, and prevents the diminish or delight packages from being
able to remove or replace this lighter.
Can this be fixed for emacs-26 ?
AndyM
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c-update-modeline format for c-block-comment-flag
2017-10-13 10:24 c-update-modeline format for c-block-comment-flag Andy Moreton
@ 2017-10-13 12:24 ` Eli Zaretskii
2017-10-13 14:45 ` Alan Mackenzie
1 sibling, 0 replies; 6+ messages in thread
From: Eli Zaretskii @ 2017-10-13 12:24 UTC (permalink / raw)
To: Andy Moreton; +Cc: emacs-devel
> From: Andy Moreton <andrewjmoreton@gmail.com>
> Date: Fri, 13 Oct 2017 11:24:03 +0100
>
> (defun c-update-modeline ()
> (let ((fmt (format "/%s%s%s%s%s"
> (if c-block-comment-flag "*" "/")
> (if c-electric-flag "l" "")
> (if (and c-electric-flag c-auto-newline)
> "a" "")
> (if c-hungry-delete-key "h" "")
> (if (and
> ;; (cc-)subword might not be loaded.
> (boundp 'c-subword-mode)
> (symbol-value 'c-subword-mode))
> ;; FIXME: subword-mode already comes with its
> ;; own lighter!
> "w"
> "")))
>
> This fixed "/" in the modeline string forces this submode lighter to be
> always present, and prevents the diminish or delight packages from being
> able to remove or replace this lighter.
>
> Can this be fixed for emacs-26 ?
Depends on the fix and on when this was introduced.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c-update-modeline format for c-block-comment-flag
2017-10-13 10:24 c-update-modeline format for c-block-comment-flag Andy Moreton
2017-10-13 12:24 ` Eli Zaretskii
@ 2017-10-13 14:45 ` Alan Mackenzie
2017-10-13 15:20 ` Andy Moreton
1 sibling, 1 reply; 6+ messages in thread
From: Alan Mackenzie @ 2017-10-13 14:45 UTC (permalink / raw)
To: Andy Moreton; +Cc: emacs-devel
Hello, Andy.
On Fri, Oct 13, 2017 at 11:24:03 +0100, Andy Moreton wrote:
> Hi,
> The handling of c-block-comment-flag in c-update-modeline is
> unfortunate:
> (defun c-update-modeline ()
> (let ((fmt (format "/%s%s%s%s%s"
> (if c-block-comment-flag "*" "/")
> (if c-electric-flag "l" "")
> (if (and c-electric-flag c-auto-newline)
> "a" "")
> (if c-hungry-delete-key "h" "")
> (if (and
> ;; (cc-)subword might not be loaded.
> (boundp 'c-subword-mode)
> (symbol-value 'c-subword-mode))
> ;; FIXME: subword-mode already comes with its
> ;; own lighter!
> "w"
> "")))
> This fixed "/" in the modeline string forces this submode lighter to be
> always present, .....
How? What mechanism do you mean?
> .... and prevents the diminish or delight packages from being able to
> remove or replace this lighter.
I'm not familiar with either of these packages. How does the fixed "/"
prevent these packages from working?
> Can this be fixed for emacs-26 ?
What do you mean by "fixed", here? What do you want to do with this
portion of the mode line, exactly?
> AndyM
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c-update-modeline format for c-block-comment-flag
2017-10-13 14:45 ` Alan Mackenzie
@ 2017-10-13 15:20 ` Andy Moreton
2017-10-13 15:36 ` Alan Mackenzie
0 siblings, 1 reply; 6+ messages in thread
From: Andy Moreton @ 2017-10-13 15:20 UTC (permalink / raw)
To: emacs-devel
On Fri 13 Oct 2017, Alan Mackenzie wrote:
> Hello, Andy.
>
> On Fri, Oct 13, 2017 at 11:24:03 +0100, Andy Moreton wrote:
>> Hi,
>
>> The handling of c-block-comment-flag in c-update-modeline is
>> unfortunate:
>
>> (defun c-update-modeline ()
>> (let ((fmt (format "/%s%s%s%s%s"
>> (if c-block-comment-flag "*" "/")
>> (if c-electric-flag "l" "")
>> (if (and c-electric-flag c-auto-newline)
>> "a" "")
>> (if c-hungry-delete-key "h" "")
>> (if (and
>> ;; (cc-)subword might not be loaded.
>> (boundp 'c-subword-mode)
>> (symbol-value 'c-subword-mode))
>> ;; FIXME: subword-mode already comes with its
>> ;; own lighter!
>> "w"
>> "")))
>
>> This fixed "/" in the modeline string forces this submode lighter to be
>> always present, .....
>
> How? What mechanism do you mean?
The lighter for c-mode changed from "C" to "C//" or "C/*".
The lighter for c++-mode changed from "C++" to "C++//" or "C++/*".
Both of these changes do not allow me to omit the lighter, or to change
it to something else without replacing the implementation of
c-update-modeline.
>> .... and prevents the diminish or delight packages from being able to
>> remove or replace this lighter.
>
> I'm not familiar with either of these packages. How does the fixed "/"
> prevent these packages from working?
I've not found a way to get them to work with varying strings.
>> Can this be fixed for emacs-26 ?
>
> What do you mean by "fixed", here? What do you want to do with this
> portion of the mode line, exactly?
Allow the "//" or "/*" to be omitted entirely, or replaced with a
different string as the lighter for those sub-modes.
AndyM
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c-update-modeline format for c-block-comment-flag
2017-10-13 15:20 ` Andy Moreton
@ 2017-10-13 15:36 ` Alan Mackenzie
2017-10-13 16:25 ` Andy Moreton
0 siblings, 1 reply; 6+ messages in thread
From: Alan Mackenzie @ 2017-10-13 15:36 UTC (permalink / raw)
To: Andy Moreton; +Cc: emacs-devel
Hello again, Andy.
On Fri, Oct 13, 2017 at 16:20:48 +0100, Andy Moreton wrote:
> On Fri 13 Oct 2017, Alan Mackenzie wrote:
> > Hello, Andy.
> > On Fri, Oct 13, 2017 at 11:24:03 +0100, Andy Moreton wrote:
> >> Hi,
> >> The handling of c-block-comment-flag in c-update-modeline is
> >> unfortunate:
> >> (defun c-update-modeline ()
> >> (let ((fmt (format "/%s%s%s%s%s"
> >> (if c-block-comment-flag "*" "/")
> >> (if c-electric-flag "l" "")
> >> (if (and c-electric-flag c-auto-newline)
> >> "a" "")
> >> (if c-hungry-delete-key "h" "")
> >> (if (and
> >> ;; (cc-)subword might not be loaded.
> >> (boundp 'c-subword-mode)
> >> (symbol-value 'c-subword-mode))
> >> ;; FIXME: subword-mode already comes with its
> >> ;; own lighter!
> >> "w"
> >> "")))
> >> This fixed "/" in the modeline string forces this submode lighter to be
> >> always present, .....
> > How? What mechanism do you mean?
> The lighter for c-mode changed from "C" to "C//" or "C/*".
> The lighter for c++-mode changed from "C++" to "C++//" or "C++/*".
The lighter for these modes has "always" included a "/" followed by
status letters, where "always" means for at least 15 years. The "*" or
second "/" is a recent innovation to indicate the current default form of
comments.
> Both of these changes do not allow me to omit the lighter, or to change
> it to something else without replacing the implementation of
> c-update-modeline.
The form of this section of the mode line matches the regexp
"/[/*]l?a?h?w?". Perhaps one of these packages could be enhanced to
handle regexps, if they can't already do so.
> >> .... and prevents the diminish or delight packages from being able to
> >> remove or replace this lighter.
> > I'm not familiar with either of these packages. How does the fixed "/"
> > prevent these packages from working?
> I've not found a way to get them to work with varying strings.
How about enhancing one of them to do so?
> >> Can this be fixed for emacs-26 ?
> > What do you mean by "fixed", here? What do you want to do with this
> > portion of the mode line, exactly?
> Allow the "//" or "/*" to be omitted entirely, or replaced with a
> different string as the lighter for those sub-modes.
With the first of my questions, I was really asking you how you want CC
Mode to be fixed. I think I now understand that you want to replace the
string.
> AndyM
--
Alan Mackenzie (Nuremberg, Germany).
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: c-update-modeline format for c-block-comment-flag
2017-10-13 15:36 ` Alan Mackenzie
@ 2017-10-13 16:25 ` Andy Moreton
0 siblings, 0 replies; 6+ messages in thread
From: Andy Moreton @ 2017-10-13 16:25 UTC (permalink / raw)
To: emacs-devel
On Fri 13 Oct 2017, Alan Mackenzie wrote:
> The lighter for these modes has "always" included a "/" followed by
> status letters, where "always" means for at least 15 years. The "*" or
> second "/" is a recent innovation to indicate the current default form of
> comments.
Most of those letters are disabled in my usage, so I notice it less.
The mode reported by Dired has changed - that used to be "C" or "C++"
in 25.3, but is now e.g. "C/*" or "C++//".
It would perhaps be more flexible to configure these lighters as minor
modes, e.g. to show the c style I have:
(define-minor-mode c-show-style-mode
"Minor mode to display the C indentation style in the mode line."
:lighter (c-show-style-mode
(" " (:propertize c-indentation-style face italic))))
(defun ajm:c-mode-common-init ()
(c-show-style-mode 1))
(add-hook 'c-mode-common-hook 'ajm:c-mode-common-init)
AndyM
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-13 16:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-13 10:24 c-update-modeline format for c-block-comment-flag Andy Moreton
2017-10-13 12:24 ` Eli Zaretskii
2017-10-13 14:45 ` Alan Mackenzie
2017-10-13 15:20 ` Andy Moreton
2017-10-13 15:36 ` Alan Mackenzie
2017-10-13 16:25 ` Andy Moreton
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.