From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stephen Berman Newsgroups: gmane.emacs.help Subject: Re: Weird capitalisation in " enabled in current buffer" Date: Wed, 31 Aug 2022 18:20:04 +0200 Message-ID: <87sflcl70r.fsf@gmx.net> References: <87a67k63r4.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37814"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: gnu-emacs-help@gnu.org To: Joost Kremers Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 31 18:27:19 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oTQYh-0009Z7-D0 for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 31 Aug 2022 18:27:19 +0200 Original-Received: from localhost ([::1]:50294 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oTQYb-0006rC-Ib for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 31 Aug 2022 12:27:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTQRy-0000Gx-58 for help-gnu-emacs@gnu.org; Wed, 31 Aug 2022 12:20:22 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:46236) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTQRx-0000Mj-SM for help-gnu-emacs@gnu.org; Wed, 31 Aug 2022 12:20:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38966) by fencepost.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTQRx-0008Ks-DV for gnu-emacs-help@gnu.org; Wed, 31 Aug 2022 12:20:21 -0400 Original-Received: from mout.gmx.net ([212.227.17.20]:44145) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oTQRv-0000Jo-5X for gnu-emacs-help@gnu.org; Wed, 31 Aug 2022 12:20:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1661962804; bh=ZjZ2/q3soI/HCdHOfxc2J+YVDdDd7N3PJMXrnF2NkvQ=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=frnEgjb1ZCzCvKaucH5WJ+1WFLWFMPD4h8DUE4V4V8GJfljuGlVt1FBXJwMZWU16r MTDpPll1HvzF9UBR6IRh0bUR/lQ4aKaKhJmx+ioyDSA1L9raJQVHNMlLdHYvs3/bzg KRoEHrkUiqCSckokARHqGjbWi2ugRPuoLIAI5cR0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from strobelfs2 ([89.246.38.72]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mq2jC-1pFBW22fo2-00nBgm; Wed, 31 Aug 2022 18:20:04 +0200 In-Reply-To: <87a67k63r4.fsf@fastmail.fm> (Joost Kremers's message of "Wed, 31 Aug 2022 13:34:12 +0200") X-Provags-ID: V03:K1:jBTttkOeuRqP0IVfP05AW3qWF7IenhMEbzVw2lSzc0zczQiQe/R WbKwJPGoHSfqBynWJaSeU5+E4K9VWbL4IxyRKm7cvg44Q8O8a1ig2KqkumtCHSHIcGRD1vs 59cDmHx7pFTnfvXFSH1SlsG8VAdzg2pwCvefpFjQmWYgN+3FHcWvpUXc2o76Rw2mxVmmTXR HXflEJCk4ow4nnJ7m3Vfg== X-UI-Out-Filterresults: notjunk:1;V03:K0:dIrOTfgqzFE=:oDHXYquW5/s5dSwxQuJoJi sm2ZrJJgRc9Sr4iGU/Js2BfN18djPfBY/657akBlxxnoMMUJ2qVmhk7wmp9P4v2+CoMgBUKic VwhJb/UxF57jMFPS1WuvxYYR7HLKUEVlnKjCJVtBu4mdX9B4OixGZxhRm3LcLSfejMir2hXtw ZlqA0MZwfgADCz58xwoyaVAw9H+UTplSzFKhFvzx0J0kv6SMFNUiWBnh0n4YjTfN2LekgZTyO heqUF6P7mjg8JAQQLKhKRuIXwKArjct/t5iNYAdj159G9KDeKo+cCll5xNknxTev4sFyQFBZj q7szdxRY36WGmSROLkBfEAMHzCBTbv/Q0xSPhMWzlk6/RgbcDYy0aoGGh3c6Fe3HjWEhDuSU7 B6EcySyNrD9RCe7NG/h1BeHB0UKnJfNQXq63ym1pk4ZQlphRREl0MKCEcM5NSsfh8DAiYFH3D cVuy3bwE5VRo9PiDopBRgEa90yyZ4ZtTSu73pg/1/MgGks3NuhYUF7LaauzveN7wAHt9C7UBy cfkRouZuWpTDx1xlWcF1xcLeBhjH6wxNBNZikBbH0yT7zNeEzX2cjtj7hVebhwLJSbkNBWS03 3+5ZVUzKbj7SITYPaXmssT5sCoNq2nSadtWfa04iLdmAOU5pI5QpqEi8F1yA4J55fAxcRq+w5 YgciN1MhjMnTZRk2f07yKJIYYfGA9gIDCt7cYrikAJHldE6TWxTLEgkjmq63sae53qruzLQ8z QSgOuV6gRgnCKJPYf7kdju0fSH56Jss5zdCvRvpa8OiXcbt+i6rUVh8v0Nsyv5YOTp4qG+tc Received-SPF: pass client-ip=212.227.17.20; envelope-from=stephen.berman@gmx.net; helo=mout.gmx.net X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:139201 Archived-At: --=-=-= Content-Type: text/plain On Wed, 31 Aug 2022 13:34:12 +0200 Joost Kremers 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 --=-=-= Content-Type: text/x-patch Content-Disposition: inline Content-Description: easy-mmode patch Content-Transfer-Encoding: quoted-printable diff --git a/lisp/emacs-lisp/easy-mmode.el b/lisp/emacs-lisp/easy-mmode.el index c3a4e9fc7a..e70946921e 100644 =2D-- 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 --=-=-=--