unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: inigoserna@gmx.com, Stefan Monnier <monnier@iro.umontreal.ca>
Cc: yantar92@posteo.net, morgan@ice9.digital, emacs-devel@gnu.org
Subject: Re: Possible bug: org-capture fails when emacs started as daemon
Date: Wed, 16 Aug 2023 17:04:29 +0300	[thread overview]
Message-ID: <83cyzn84nm.fsf@gnu.org> (raw)
In-Reply-To: <871qg3wcav.fsf@gmx.com> (message from Iñigo Serna on Wed, 16 Aug 2023 11:25:01 +0200)

> From: Iñigo Serna <inigoserna@gmx.com>
> Cc: Ihor Radchenko <yantar92@posteo.net>, morgan@ice9.digital,
>  emacs-devel@gnu.org
> Date: Wed, 16 Aug 2023 11:25:01 +0200
> 
> I've attached a simple case for the bug.
> I can reproduce the issue with emacs v29 and master.

Thanks.

> In the example, there is a `minibuffer-setup-hook' to modify
> minibuffer face, and a simple minor-mode which changes
> `mode-line-active' face background color when enabled.

AFAIU, the minibuffer-setup-hook part is not needed for this recipe to
demonstrate the problem.

> Then, when `test-mode' is enabled, `clone-indirect-buffer' fails.
> 
> Steps:
> 1. $ emacs -q -l test.el    -> note minibuffer font size is bigger
> 2. M-x test-mode            -> note mode-line background color 
> changes
> 3. M-x clone-indirect-buffer
>    => Error: "face-attrs--make-indirect-safe: Wrong type argument: 
>    listp, test-modeline"
> 
> 
> A complete backtrace:
> 
> Debugger entered--Lisp error: (wrong-type-argument listp 
> test-modeline)
>   face-remap--copy-face((mode-line-active . test-modeline))
>   face-attrs--make-indirect-safe()
>   clone-indirect-buffer(nil t)
>   funcall-interactively(clone-indirect-buffer nil t)
>   command-execute(clone-indirect-buffer record)
>   execute-extended-command(nil "clone-indirect-buffer" "clone-in")
>   funcall-interactively(execute-extended-command nil 
>   "clone-indirect-buffer" "clone-in")
>   command-execute(execute-extended-command)

Please see if the patch below gives good results.

Stefan, any comments?  You wrote the face-remap--copy-face stuff,
AFAICT.

diff --git a/lisp/face-remap.el b/lisp/face-remap.el
index 3ec271b..e86a292 100644
--- a/lisp/face-remap.el
+++ b/lisp/face-remap.el
@@ -70,6 +70,7 @@ internal-lisp-face-attributes
    :foreground :background :stipple :overline :strike-through :box
    :font :inherit :fontset :distant-foreground :extend :vector])
 
+(autoload 'cl-copy-list "cl-lib")
 (defun face-remap--copy-face (val)
   "Return a copy of the `face' property value VAL."
   ;; A `face' property can be either a face name (a symbol), or a face
@@ -79,7 +80,10 @@ face-remap--copy-face
   ;; `add-face-text-property'.
   (if (or (not (listp val)) (keywordp (car val)))
       val
-    (copy-sequence val)))
+    ;; Handle association (foo . bar) from face-remapping-alist.
+    (if (not (proper-list-p val))
+        (cl-copy-list val)
+      (copy-sequence val))))
 
 (defun face-attrs--make-indirect-safe ()
   "Deep-copy the buffer's `face-remapping-alist' upon cloning the buffer."



  reply	other threads:[~2023-08-16 14:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-12 12:14 Possible bug: org-capture fails when emacs started as daemon Iñigo Serna
2023-08-12 17:05 ` Morgan Willcock
2023-08-13 15:09   ` Iñigo Serna
2023-08-13  8:37 ` Ihor Radchenko
2023-08-13 15:29   ` Iñigo Serna
2023-08-13 15:38     ` Ihor Radchenko
2023-08-15 16:53       ` Morgan Willcock
2023-08-15 16:57         ` Ihor Radchenko
2023-08-15 18:57           ` Eli Zaretskii
2023-08-16  9:25             ` Iñigo Serna
2023-08-16 14:04               ` Eli Zaretskii [this message]
2023-08-16 14:59                 ` Iñigo Serna
2023-08-16 15:00                 ` Stefan Monnier
2023-08-16 15:44                   ` Iñigo Serna
2023-08-16 17:04                   ` Eli Zaretskii
2023-08-16 17:46                     ` Stefan Monnier
2023-08-17  7:53                       ` Eli Zaretskii

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=83cyzn84nm.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=inigoserna@gmx.com \
    --cc=monnier@iro.umontreal.ca \
    --cc=morgan@ice9.digital \
    --cc=yantar92@posteo.net \
    /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).