From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: =?UTF-8?Q?Levels_of_font_lock_=E2=80=93_Dired=2C_Dired=2B_and_Diredful?= Date: Mon, 22 May 2017 16:48:52 +0700 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1495446589 25645 195.159.176.226 (22 May 2017 09:49:49 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 22 May 2017 09:49:49 +0000 (UTC) To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon May 22 11:49:44 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dCjyA-0006Uf-99 for geh-help-gnu-emacs@m.gmane.org; Mon, 22 May 2017 11:49:42 +0200 Original-Received: from localhost ([::1]:41471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCjyF-0008M8-Pk for geh-help-gnu-emacs@m.gmane.org; Mon, 22 May 2017 05:49:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dCjxl-0008M0-AE for help-gnu-emacs@gnu.org; Mon, 22 May 2017 05:49:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dCjxk-0005YB-Ch for help-gnu-emacs@gnu.org; Mon, 22 May 2017 05:49:17 -0400 Original-Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]:36948) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dCjxk-0005La-6k for help-gnu-emacs@gnu.org; Mon, 22 May 2017 05:49:16 -0400 Original-Received: by mail-wm0-x22a.google.com with SMTP id d127so145777345wmf.0 for ; Mon, 22 May 2017 02:49:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:from:date:message-id:subject:to :content-transfer-encoding; bh=C8aM4gk2SCj2T+K+nZ+FnLRv9NCufuoN/0lizbniCq4=; b=dq0+0tZpXqwnrDXCGZsmv0q61fLOjXE4tWvUVnno94j7eyka7ucLiA8RK234jSRyPa 7GCt8tltrkXTIJ1GuLXQAT68HviQClWdP/IaCs4zSs3T4M95SuJObKOoSaHq4sB+6Yct ukwZ3omJNe4GfT3GlxyrnqqskcIrNxPSOEzfK8xGWiDlLVr68mUA0OQqm556XKfKan1J 5HuxJ81bgRjGokGt5eN2m4Nb0mgHIB6stH1pK4cQxF5Pmrr0n3hjmLUVKtCK/7eF41KT K33njDMIf9Xk42y4oan2KhYN4zyJXie6rfuBSl10enZbYxImJMph4JfUQxEC/7eC0HcU Oakw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:from:date:message-id:subject :to:content-transfer-encoding; bh=C8aM4gk2SCj2T+K+nZ+FnLRv9NCufuoN/0lizbniCq4=; b=IOU04l0IxF8GCcsnPAMaTN6WfhR6VuGiLAm3IoKi9OMh4BPeajhSczCU5IdUWdPcfl G6gSUFjx5UmKFOIGLM1ViqDhx6gMvx2AJfKQWeIgdw96yhV8bbNgRWA+pBx4Y/dE5R8O JwEIiJV5k0kAoqtaHuHEMFcUPOMuKLNBlDJ+kX78ButMyvUjiTV7UBWORY9GdOSkaUTN UABCZXNjnd7clmN7UYvAvAVbes/mt2Mw0xyroFK3JboXhWZiVOChZwhiUSqUMNxhRXQp ekT4fzRh8kdMv2s2xttsL5cGlH1PQ1G0lSmjmjAVOzBxfSyQu/X46perkEoW+pSBnhvD LSFQ== X-Gm-Message-State: AODbwcCnkmSqDcPXgqIwSaKL4UwB/6/eQiCjXo9KsJzIoR0YMTq1kdHu aQVJe2RxC1X6j90Eb3FP9Tp4/GC9g9xr X-Received: by 10.223.160.139 with SMTP id m11mr9789985wrm.99.1495446552740; Mon, 22 May 2017 02:49:12 -0700 (PDT) Original-Received: by 10.223.163.196 with HTTP; Mon, 22 May 2017 02:48:52 -0700 (PDT) X-Google-Sender-Auth: oxxeXGcXIJV1RTgGfL06egTG6P4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22a X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:113122 Archived-At: Hello list, I just spent an hour investigating an interaction of multiple packages tinkering with font lock. I=E2=80=99m pretty sure I ought to file a bug rep= ort but not so sure against what. There is a concept of levels of font lock. A major mode sets up three lists of keywords in a buffer-local =E2=80=98font-lock-defaults=E2=80=99 va= riable. Then, depending on the user=E2=80=99s =E2=80=98font-lock-maximum-decoration= =E2=80=99, more or fewer keywords get applied. The base Dired mode defines only one level: (setq-local font-lock-defaults '(dired-font-lock-keywords t nil nil beginning-of-line)) Dired+ by Drew Adams, in its dired-mode-hook handler, replaces that with a three-element list with two different sets of keywords: (set (make-local-variable 'font-lock-defaults) ;; Two levels. Use 3-element list, since it is standard to have one more ;; than the number of levels. This is necessary for it to work with ;; `font(-lock)-menus.el'. '((dired-font-lock-keywords dired-font-lock-keywords diredp-font-lock-keywords-1) t nil nil beginning-of-line)) Diredful by Thamer Mahmoud keeps a list of rules for highlighting files by extension, file name regexp, or full Dired line regexp, and provides a convenient UI for editing these rules. Behind the scene, it adds keywords to =E2=80=98dired-font-lock-keywords=E2=80=99: (add-to-list 'dired-font-lock-keywords (list regexp face-list)) Now the problem is when I use both of these together. I play on the Insane level (font-lock-maximum-decoration set to t). It appears that I =E2=80=9Conly=E2=80=9D get the last level of font lock =E2=80=94 =E2=80=98diredp-font-lock-keywords-1=E2=80=99 from Dired+. I do not get the= additions by Diredful. I can work around the issue by changing Diredful to add to both lists (dired-font-lock-keywords and diredp-font-lock-keywords-1). But this feels wrong; Diredful should not have to know about Dired+. On the other hand, I can work around the issue by changing Dired+ so that instead of =E2=80=98diredp-font-lock-keywords-1=E2=80=99 it uses a new= variable which is set in the same dired-mode-hook handler to the result of (append dired-font-lock-keywords diredp-font-lock-keywords-1). This feels cleaner but now it=E2=80=99s highly probable that some of Dired+=E2= =80=99s keywords duplicate and/or override those of base Dired. What do you think?