From: Yuri Lensky <ydl@ydl.cm> To: "emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org> Subject: [Patch] Update previews correctly with color changes Date: Wed, 24 Feb 2021 13:04:13 -0800 [thread overview] Message-ID: <CAC38U-fT22jDmOEXcjoqOODWzY61cr-Ny_YgVbo1ibreqoxjGw@mail.gmail.com> (raw) [-- Attachment #1.1: Type: text/plain, Size: 169 bytes --] The hash computed for LaTeX previews did not actually take into account the true foreground/background text color, so org would not refresh previews when themes change. [-- Attachment #1.2: Type: text/html, Size: 194 bytes --] [-- Attachment #2: 0001-lisp-org.el-Update-previews-correctly-when-color-chn.patch --] [-- Type: application/octet-stream, Size: 2129 bytes --] From dbecdbb6f3cc5f9b6d094310ecdd6c5aedfe5505 Mon Sep 17 00:00:00 2001 From: "Yuri D. Lensky" <ydl@Yuris-MacBook-Pro.local> Date: Wed, 24 Feb 2021 12:40:25 -0800 Subject: [PATCH] lisp/org.el: Update previews correctly when color chnages. * lisp/org.el (org-format-latex): When computing a hash that determines if a preview needs to be re-generated, use the actual color of the face rather than just the setting symbol. --- lisp/org.el | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 7d8733448..4ae604fe6 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -15965,15 +15965,25 @@ Some of the options can be changed using the variable (fg (let ((color (plist-get org-format-latex-options :foreground))) - (if (and forbuffer (eq color 'auto)) - (face-attribute face :foreground nil 'default) - color))) + (if forbuffer + (cond + ((eq color 'auto) + (face-attribute face :foreground nil 'default)) + ((eq color 'default) + (face-attribute 'default :foreground nil)) + (t color)) + color))) (bg (let ((color (plist-get org-format-latex-options :background))) - (if (and forbuffer (eq color 'auto)) - (face-attribute face :background nil 'default) - color))) + (if forbuffer + (cond + ((eq color 'auto) + (face-attribute face :background nil 'default)) + ((eq color 'default) + (face-attribute 'default :background nil)) + (t color)) + color))) (hash (sha1 (prin1-to-string (list org-format-latex-header org-latex-default-packages-alist -- 2.24.3 (Apple Git-128)
next reply other threads:[~2021-02-24 21:05 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-02-24 21:04 Yuri Lensky [this message] 2021-04-27 7:46 ` Bastien
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.orgmode.org/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=CAC38U-fT22jDmOEXcjoqOODWzY61cr-Ny_YgVbo1ibreqoxjGw@mail.gmail.com \ --to=ydl@ydl.cm \ --cc=emacs-orgmode@gnu.org \ --subject='Re: [Patch] Update previews correctly with color changes' \ /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
Code repositories for project(s) associated with this inbox: https://git.savannah.gnu.org/cgit/emacs/org-mode.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).