From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id WEIgBHAeY19HegAA0tVLHw (envelope-from ) for ; Thu, 17 Sep 2020 08:29:36 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id MC6JO28eY1/YBAAAbx9fmQ (envelope-from ) for ; Thu, 17 Sep 2020 08:29:35 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 380D99402CC for ; Thu, 17 Sep 2020 08:29:35 +0000 (UTC) Received: from localhost ([::1]:52570 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kIpIM-0003s4-4D for larch@yhetil.org; Thu, 17 Sep 2020 04:29:34 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60118) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kIpFK-0000B0-38 for emacs-orgmode@gnu.org; Thu, 17 Sep 2020 04:26:26 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:36697) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kIpFH-0005mq-EL; Thu, 17 Sep 2020 04:26:25 -0400 Received: by mail-pf1-x42c.google.com with SMTP id d9so757031pfd.3; Thu, 17 Sep 2020 01:26:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=fXn9P09BWw8wGx2jR3AHHm0j7VDvvoaF1jsP++BzbXk=; b=LzhNwGyBkgGbct5M12aMMv8IX9TJumRa6byb+mTJ0r4xnnM4h4/T1B+BTnnle8purS +mJohcifHLYn94k2YdzYEsZ+C0fh2dA5eYCeRGA0JwfAJoGkJge329CLhzADZbwBhPoa W/1JXuFWI4a495ZvzRiRSU3yo7TIZSsYU5QYGQwCrvU1GPdAhcTfq9ZlR0fnBqPjsLmd UYSiIIca3MUNVWeLXb2SySidKOTazpa5WJbqoTSnhtJ6STdBAhXraietOwUuS9JXiiQD MUcPcj4cI7jnExbCtUjjX2BCqQkqPlwgjxYTRIN9g0AsfkqRjBUrD+CIt1IsPH8M4B97 wgTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=fXn9P09BWw8wGx2jR3AHHm0j7VDvvoaF1jsP++BzbXk=; b=ZSmgxUwQBCPzzw5PqNVZ/+YWF8GMt5VC4ntPawz7EHuyb8r418yiXXkcQcM5csdr6k HgYYDt/odtojCfbkBMMb2ph6u1cgrPF0lQdLFFVXnSlUMSVTE0phGdtN3FjSezYKlsxY FKe1yG2xD2ahzB88izOTzMu/hsOv5jDm8EF1NCWX5Sit4tQIgOFYvPC0N0i0TInm/t0D MP8FH1wxwUGTvY2dmVRT0nmIYTGrtnkC0CTgVCpeGNEUDaaECUKjxYOkNWccBe4/EX/Y kvsomcRDV2KwRCUJo25j6Ltz+DDFfM/cDcUN5RRougQg/lcjKCnHen2VxhDAvI/eQg3Q TIEA== X-Gm-Message-State: AOAM530LXLtBnipmuNu4fctf+zXTrjXJMx4R0/0fCqZN9CHcaggHnj1e h/tllakXTkB3Fj0Nkie+9cU= X-Google-Smtp-Source: ABdhPJyqCxECTgBPZwuytVvA0Hpkzt7BPBH/oQ2CNnVINgcRIOZfepwUr421IDD8nNbu35YQZSXZhQ== X-Received: by 2002:a05:6a00:1356:b029:13e:5203:fba3 with SMTP id k22-20020a056a001356b029013e5203fba3mr25648600pfu.3.1600331180739; Thu, 17 Sep 2020 01:26:20 -0700 (PDT) Received: from localhost ([104.250.131.79]) by smtp.gmail.com with ESMTPSA id gg13sm4993529pjb.3.2020.09.17.01.26.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Sep 2020 01:26:18 -0700 (PDT) From: Ihor Radchenko To: Protesilaos Stavrou , Bastien Subject: [PATCH] Adaptive Org faces in headings? In-Reply-To: <87o8mbxxdr.fsf@protesilaos.com> References: <878sii4yj7.fsf@protesilaos.com> <871rje9qkf.fsf@protesilaos.com> <87k0x3l4h2.fsf@gnu.org> <87o8mbxxdr.fsf@protesilaos.com> Date: Thu, 17 Sep 2020 16:25:17 +0800 Message-ID: <87363gn72q.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=yantar92@gmail.com; helo=mail-pf1-x42c.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Diego Zamboni , Org-mode Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=LzhNwGyB; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Spam-Score: -0.21 X-TUID: RmGP0skEX/6l --=-=-= Content-Type: text/plain The attached patch seems to fix the issue. Can anyone test? Best, Ihor --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Make-sure-that-headline-faces-take-precedence.patch >From 7a5bfe2f514af1f6af48652155732dbcb9fe22d0 Mon Sep 17 00:00:00 2001 From: Ihor Radchenko Date: Thu, 17 Sep 2020 16:14:11 +0800 Subject: [PATCH] Make sure that headline faces take precedence * lisp/org.el (org-activate-links): Prepend instead of overriding existing face. (org-set-font-lock-defaults): Prepend keyword, `org-headline-todo', and `org-headline-done' faces instead of overriding. (org-font-lock-add-priority-faces): Prepend priority face instead of overriding. (org-font-lock-add-tag-faces): Prepend tag faces instead of overriding. Fix bug when org-level-N headline face is overridden while fontifying smaller elements within headline. Prepend the element faces instead. --- lisp/org.el | 62 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index bc74cedc7..69040a540 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5142,30 +5142,31 @@ This includes angle, plain, and bracket links." (link (org-element-property :raw-link link-object)) (type (org-element-property :type link-object)) (path (org-element-property :path link-object)) + (face-property (pcase (org-link-get-parameter type :face) + ((and (pred functionp) face) (funcall face path)) + ((and (pred facep) face) face) + ((and (pred consp) face) face) ;anonymous + (_ 'org-link))) (properties ;for link's visible part - (list - 'face (pcase (org-link-get-parameter type :face) - ((and (pred functionp) face) (funcall face path)) - ((and (pred facep) face) face) - ((and (pred consp) face) face) ;anonymous - (_ 'org-link)) - 'mouse-face (or (org-link-get-parameter type :mouse-face) - 'highlight) - 'keymap (or (org-link-get-parameter type :keymap) - org-mouse-map) - 'help-echo (pcase (org-link-get-parameter type :help-echo) - ((and (pred stringp) echo) echo) - ((and (pred functionp) echo) echo) - (_ (concat "LINK: " link))) - 'htmlize-link (pcase (org-link-get-parameter type - :htmlize-link) - ((and (pred functionp) f) (funcall f)) - (_ `(:uri ,link))) - 'font-lock-multiline t))) + (list 'mouse-face (or (org-link-get-parameter type :mouse-face) + 'highlight) + 'keymap (or (org-link-get-parameter type :keymap) + org-mouse-map) + 'help-echo (pcase (org-link-get-parameter type :help-echo) + ((and (pred stringp) echo) echo) + ((and (pred functionp) echo) echo) + (_ (concat "LINK: " link))) + 'htmlize-link (pcase (org-link-get-parameter type + :htmlize-link) + ((and (pred functionp) f) (funcall f)) + (_ `(:uri ,link))) + 'font-lock-multiline t))) (org-remove-flyspell-overlays-in start end) (org-rear-nonsticky-at end) (if (not (eq 'bracket style)) - (add-text-properties start end properties) + (progn + (add-face-text-property start end face-property) + (add-text-properties start end properties)) ;; Handle invisible parts in bracket links. (remove-text-properties start end '(invisible nil)) (let ((hidden @@ -5174,6 +5175,7 @@ This includes angle, plain, and bracket links." 'org-link)) properties))) (add-text-properties start visible-start hidden) + (add-face-text-property visible-start visible-end face-property) (add-text-properties visible-start visible-end properties) (add-text-properties visible-end end hidden) (org-rear-nonsticky-at visible-start) @@ -5641,7 +5643,7 @@ needs to be inserted at a specific position in the font-lock sequence.") ;; TODO keyword (list (format org-heading-keyword-regexp-format org-todo-regexp) - '(2 (org-get-todo-face 2) t)) + '(2 (org-get-todo-face 2) prepend)) ;; TODO (when org-fontify-todo-headline (list (format org-heading-keyword-regexp-format @@ -5649,7 +5651,7 @@ needs to be inserted at a specific position in the font-lock sequence.") "\\(?:" (mapconcat 'regexp-quote org-not-done-keywords "\\|") "\\)")) - '(2 'org-headline-todo t))) + '(2 'org-headline-todo prepend))) ;; DONE (when org-fontify-done-headline (list (format org-heading-keyword-regexp-format @@ -5657,7 +5659,7 @@ needs to be inserted at a specific position in the font-lock sequence.") "\\(?:" (mapconcat 'regexp-quote org-done-keywords "\\|") "\\)")) - '(2 'org-headline-done t))) + '(2 'org-headline-done prepend))) ;; Priorities '(org-font-lock-add-priority-faces) ;; Tags @@ -5841,18 +5843,24 @@ If TAG is a number, get the corresponding match group." (defun org-font-lock-add-priority-faces (limit) "Add the special priority faces." (while (re-search-forward org-priority-regexp limit t) + (add-face-text-property + (match-beginning 1) + (match-end 1) + (org-get-priority-face (string-to-char (match-string 2)))) (add-text-properties (match-beginning 1) (match-end 1) - (list 'face (org-get-priority-face (string-to-char (match-string 2))) - 'font-lock-fontified t)))) + (list 'font-lock-fontified t)))) (defun org-font-lock-add-tag-faces (limit) "Add the special tag faces." (when (and org-tag-faces org-tags-special-faces-re) (while (re-search-forward org-tags-special-faces-re limit t) + (add-face-text-property + (match-beginning 1) + (match-end 1) + (org-get-tag-face 1)) (add-text-properties (match-beginning 1) (match-end 1) - (list 'face (org-get-tag-face 1) - 'font-lock-fontified t)) + (list 'font-lock-fontified t)) (backward-char 1)))) (defun org-unfontify-region (beg end &optional _maybe_loudly) -- 2.26.2 --=-=-= Content-Type: text/plain Protesilaos Stavrou writes: > Bastien [2020-09-09, 10:49 +0200]: > >> Protesilaos Stavrou writes: >> >>> Diego Zamboni [2020-09-05, 23:39 +0200]: >>> >>>> I had seen the same in my setup. I recently started using Doom Emacs >>>> (https://github.com/hlissner/doom-emacs/) and was pleasantly surprised >>>> to discover that todo and tag faces scale according to the headline in >>>> which they are. I don't know precisely how this is done, but there are >>>> some hints here, you might use it as a starting point: >>>> https://github.com/hlissner/doom-emacs/blob/develop/modules/lang/org/config.el#L146-L175 >>> >>> I noticed that the doom-themes have some extra code to fontify Org.[0] >>> It also has some opinionated extras that do not belong to the issue I >>> raised. I am curious whether this was ever shared/discussed on this >>> mailing list. >> >> I can't remember any such discussion. >> >> (In general, it would be good if downstream enhancements like these >> could be shared upstream, we are generally quite grateful for help!) >> >> In any case, thanks for reporting this issue, I confirm we should >> work on it for a future release. >> >> Patches welcome, > > Hello again! > > I am not sure I can help with the patch, but at least I can share some > more user feedback. > > Please see the attached screenshots that could help improve our > understanding of the issue. The gist is that Org already has working > code that adapts some faces to the underlying heading style (in this > case font height and weight). > > To reproduce this demo on emacs -Q: > > + Open an org-mode file, e.g. C-x C-f /tmp/test.org > + Insert a level 1 heading: > > * TODO [#A] Do they adapt ~test-heading-faces~ and =another-test=? > > + Evaluate each of the expressions in the code block and notice how the > heading's faces adapt to it: > > #+begin_src emacs-lisp > (set-face-attribute 'org-level-1 nil :height 3.0 :weight 'normal) > (set-face-attribute 'org-level-1 nil :weight 'bold) > #+end_src > > This is in addition to what I noted in a previous message: > https://lists.gnu.org/archive/html/emacs-orgmode/2020-09/msg00331.html > > Best regards, > Protesilaos > > -- > Protesilaos Stavrou > protesilaos.com --=-=-=--