emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Possible bug: org-capture fails when emacs started as daemon


From: Eli Zaretskii
Subject: Re: Possible bug: org-capture fails when emacs started as daemon
Date: Wed, 16 Aug 2023 17:04:29 +0300

> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]