* Weird capitalisation in "<mode-name> enabled in current buffer"
@ 2022-08-31 11:34 Joost Kremers
2022-08-31 16:20 ` Stephen Berman
0 siblings, 1 reply; 3+ messages in thread
From: Joost Kremers @ 2022-08-31 11:34 UTC (permalink / raw)
To: gnu-emacs-help
Hi list,
I "wrote" a teeny-tiny minor mode `dedicated-mode` inspired by the same-name
mode available on Melpa. It's basically just a single line:
```
(define-minor-mode dedicated-mode
"Minor mode to dedicate a window to its buffer."
:init-value nil :lighter " D" :global nil
(set-window-dedicated-p nil dedicated-mode))
```
Now, never mind that this shouldn't be a minor mode at all, since it should be
linked to the window, not the buffer. What's strange is that when I activate
this mode, the message in the echo area reads:
DeDicateD moDe enabled in current buffer
Note the capital Ds in the words "DeDicateD moDe". Same thing happens when I
deactivate the mode.
Funny thing is, if I change the :lighter in the mode definition to lower case
"d", the capitalisation does not happen.
So, what should I file this under? Bug or joke? :D
--
Joost Kremers
Life has its moments
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Weird capitalisation in "<mode-name> enabled in current buffer"
2022-08-31 11:34 Weird capitalisation in "<mode-name> enabled in current buffer" Joost Kremers
@ 2022-08-31 16:20 ` Stephen Berman
2022-08-31 21:42 ` Joost Kremers
0 siblings, 1 reply; 3+ messages in thread
From: Stephen Berman @ 2022-08-31 16:20 UTC (permalink / raw)
To: Joost Kremers; +Cc: gnu-emacs-help
[-- Attachment #1: Type: text/plain, Size: 1622 bytes --]
On Wed, 31 Aug 2022 13:34:12 +0200 Joost Kremers <joostkremers@fastmail.fm> wrote:
> Hi list,
>
> I "wrote" a teeny-tiny minor mode `dedicated-mode` inspired by the same-name
> mode available on Melpa. It's basically just a single line:
>
> ```
> (define-minor-mode dedicated-mode
> "Minor mode to dedicate a window to its buffer."
> :init-value nil :lighter " D" :global nil
> (set-window-dedicated-p nil dedicated-mode))
> ```
>
> Now, never mind that this shouldn't be a minor mode at all, since it should be
> linked to the window, not the buffer. What's strange is that when I activate
> this mode, the message in the echo area reads:
>
> DeDicateD moDe enabled in current buffer
>
> Note the capital Ds in the words "DeDicateD moDe". Same thing happens when I
> deactivate the mode.
>
> Funny thing is, if I change the :lighter in the mode definition to lower case
> "d", the capitalisation does not happen.
>
> So, what should I file this under? Bug or joke? :D
It's due to the last line in easy-mmode-pretty-mode-name:
;; Replace any (case-insensitive) matches for LIGHTER in NAME
;; with a literal LIGHTER. E.g., if NAME is "Iimage mode" and
;; LIGHTER is " iImag", then this will produce "iImage mode".
;; (LIGHTER normally comes from the mode-line string passed to
;; define-minor-mode, and normally includes at least one leading
;; space.)
(replace-regexp-in-string (regexp-quote lighter) lighter name t t))))
The patch below fixes your use case but breaks the case mentioned in the
above comment. A fix handling both cases might be tricky.
Steve Berman
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: easy-mmode patch --]
[-- Type: text/x-patch, Size: 675 bytes --]
diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el
index c3a4e9fc7a..e70946921e 100644
--- a/lisp/emacs-lisp/easy-mmode.el
+++ b/lisp/emacs-lisp/easy-mmode.el
@@ -79,7 +79,8 @@ easy-mmode-pretty-mode-name
;; (LIGHTER normally comes from the mode-line string passed to
;; define-minor-mode, and normally includes at least one leading
;; space.)
- (replace-regexp-in-string (regexp-quote lighter) lighter name t t))))
+ ;; (replace-regexp-in-string (regexp-quote lighter) lighter name t t)
+ name)))
(defconst easy-mmode--arg-docstring
"This is a %sminor mode. If called interactively, toggle the
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: Weird capitalisation in "<mode-name> enabled in current buffer"
2022-08-31 16:20 ` Stephen Berman
@ 2022-08-31 21:42 ` Joost Kremers
0 siblings, 0 replies; 3+ messages in thread
From: Joost Kremers @ 2022-08-31 21:42 UTC (permalink / raw)
To: Stephen Berman; +Cc: gnu-emacs-help, help-gnu-emacs
On Wed, Aug 31 2022, Stephen Berman wrote:
> On Wed, 31 Aug 2022 13:34:12 +0200 Joost Kremers <joostkremers@fastmail.fm>
> wrote:
[...]
>> DeDicateD moDe enabled in current buffer
>>
>> Note the capital Ds in the words "DeDicateD moDe". Same thing happens when I
>> deactivate the mode.
> It's due to the last line in easy-mmode-pretty-mode-name:
Ah, OK. But... but... why??
Anyway, thanks for the clarification.
Joost
--
Joost Kremers
Life has its moments
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-31 21:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-31 11:34 Weird capitalisation in "<mode-name> enabled in current buffer" Joost Kremers
2022-08-31 16:20 ` Stephen Berman
2022-08-31 21:42 ` Joost Kremers
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.