all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: "João Távora" <joaotavora@gmail.com>
Cc: Eli Zaretskii <eliz@gnu.org>, 68547@debbugs.gnu.org
Subject: bug#68547: [PATCH] ; Fix 'mode-line-format-right-align' with ElDoc
Date: Sat, 20 Jan 2024 11:58:25 +0100	[thread overview]
Message-ID: <m1edec9sq6.fsf@dazzs-mbp.home> (raw)
In-Reply-To: <CALDnm53Z4LppG7AUej2W5qrD_8MyA6YmYvZFFOpK5ULfv62j_w@mail.gmail.com> ("João Távora"'s message of "Sat, 20 Jan 2024 10:20:39 +0000")

[-- Attachment #1: Type: text/plain, Size: 1327 bytes --]

João Távora <joaotavora@gmail.com> writes:

> On Sat, Jan 20, 2024 at 9:57 AM Eli Zaretskii <eliz@gnu.org> wrote:
>>
>> > Date: Wed, 17 Jan 2024 20:44:04 +0100
>> > From:  Eshel Yaron via "Bug reports for GNU Emacs,
>> >  the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>> >
>> > Tags: patch
>> >
>> > The new mode line right alignment requires setting `mode-line-format` to
>> > a list that contains (as in `memq`) the symbol
>> > `mode-line-format-right-align`.  This is a bit brittle, and currently
>> > `eldoc-minibuffer-message` modifies `mode-line-format` in a way that
>> > happens to break `mode-line-format-right-align`.  To see that, set
>> > `mode-line-format` to '("" mode-line-format-right-align "foo bar") and
>> > then type `M-: (list`.  Now ElDoc info appears on the mode line, but
>> > "bar" is no longer visible.
>> >
>> > This patch makes ElDoc modify `mode-line-format` in an equivalent way
>> > that avoids messing with `mode-line-format-right-align`.
>>
>> Thanks.
>>
>> João, any objections or comments?
>
> I think it looks good.  I just think the patch is a little
> too newline friendly, i.e. the if can probably fit in a single
> line without reaching 80 columns and it'll make it easier to
> read.

Yes, it fits nicely.  See updated patch below.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: v2-0001-Fix-mode-line-format-right-align-with-ElDoc-Bug-6.patch --]
[-- Type: text/x-patch, Size: 1343 bytes --]

From 9c69e20ed172a2bfa56056a62077ae1c68b9b979 Mon Sep 17 00:00:00 2001
From: Eshel Yaron <me@eshelyaron.com>
Date: Mon, 1 Jan 2024 22:14:59 +0100
Subject: [PATCH v2] ; Fix 'mode-line-format-right-align' with ElDoc
 (Bug#68547)

* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message): Avoid nesting
'mode-line-format', since that breaks 'mode-line-format-right-align'.
---
 lisp/emacs-lisp/eldoc.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/emacs-lisp/eldoc.el b/lisp/emacs-lisp/eldoc.el
index 06970d40e8a..912a7357ca7 100644
--- a/lisp/emacs-lisp/eldoc.el
+++ b/lisp/emacs-lisp/eldoc.el
@@ -312,9 +312,11 @@ eldoc-minibuffer-message
                      (not (and (listp mode-line-format)
                                (assq 'eldoc-mode-line-string mode-line-format))))
 	    (setq mode-line-format
-		  (list "" '(eldoc-mode-line-string
-			     (" " eldoc-mode-line-string " "))
-			mode-line-format)))
+                  (funcall
+                   (if (listp mode-line-format) #'append #'list)
+                   (list "" '(eldoc-mode-line-string
+			      (" " eldoc-mode-line-string " ")))
+                   mode-line-format)))
           (setq eldoc-mode-line-string
                 (when (stringp format-string)
                   (apply #'format-message format-string args)))
-- 
2.42.0


  reply	other threads:[~2024-01-20 10:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-17 19:44 bug#68547: [PATCH] ; Fix 'mode-line-format-right-align' with ElDoc Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-20  9:56 ` Eli Zaretskii
2024-01-20 10:20   ` João Távora
2024-01-20 10:58     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-01-20 12:01       ` João Távora
2024-01-20 13:55         ` João Távora
2024-01-20 15:33           ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-20 18:08             ` João Távora
2024-01-20 18:16               ` Eli Zaretskii
2024-01-20 21:12                 ` João Távora
2024-01-21  5:18                   ` Eli Zaretskii
2024-01-21  8:34                   ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-21  8:52                     ` João Távora
2024-01-21 13:20                       ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors

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

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

  git send-email \
    --in-reply-to=m1edec9sq6.fsf@dazzs-mbp.home \
    --to=bug-gnu-emacs@gnu.org \
    --cc=68547@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=me@eshelyaron.com \
    /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 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.