From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Font locking in sh-mode stopped working (Emacs 24) Date: Tue, 11 May 2010 09:15:57 +0200 Message-ID: <201005110915.58315.tassilo@member.fsf.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1273564440 15787 80.91.229.12 (11 May 2010 07:54:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 11 May 2010 07:54:00 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue May 11 09:53:59 2010 connect(): No such file or directory Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OBkHv-0003o2-Bc for ged-emacs-devel@m.gmane.org; Tue, 11 May 2010 09:53:59 +0200 Original-Received: from localhost ([127.0.0.1]:45491 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBkHt-00069S-Ns for ged-emacs-devel@m.gmane.org; Tue, 11 May 2010 03:53:58 -0400 Original-Received: from [140.186.70.92] (port=37993 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OBkHL-00068I-Ti for emacs-devel@gnu.org; Tue, 11 May 2010 03:53:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OBkHJ-0007pX-Tm for emacs-devel@gnu.org; Tue, 11 May 2010 03:53:23 -0400 Original-Received: from deliver.uni-koblenz.de ([141.26.64.15]:9831) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OBjhC-0001Xg-35 for emacs-devel@gnu.org; Tue, 11 May 2010 03:16:02 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by deliver.uni-koblenz.de (Postfix) with ESMTP id B2F6A78A44DE for ; Tue, 11 May 2010 09:15:59 +0200 (CEST) Original-Received: from deliver.uni-koblenz.de ([127.0.0.1]) by localhost (deliver.uni-koblenz.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 20276-04 for ; Tue, 11 May 2010 09:15:59 +0200 (CEST) X-CHKRCPT: Envelopesender noch tassilo@member.fsf.org Original-Received: from thinkpad.localnet (tsdh.uni-koblenz.de [141.26.67.142]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by deliver.uni-koblenz.de (Postfix) with ESMTP id F272878A445F for ; Tue, 11 May 2010 09:15:58 +0200 (CEST) User-Agent: KMail/1.13.3 (Linux/2.6.33-gentoo-r2; KDE/4.4.3; x86_64; ; ) X-Face: `TY6r/ws=N5uqO1E`M=Sups<}n%T[E^o_?MJj List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:124694 Archived-At: Hi all, since the last time I've updated my emacs bzr checkout (2010-05-07), font-locking in sh-mode stopped working. Everything uses the `default' face. This doesn't happen with emacs -Q, but I was able to spot the part of my customization which triggers that behavior. The offending code adds support for outline headings in comments to source code files. I use that code for years, and it always worked fine. And even now, it only stopped working for sh-mode, but it still works for emacs-lisp, java or LaTeX-mode. Here's the code: --8<---------------cut here---------------start------------->8--- (defvar th-outline-minor-mode-font-lock-keywords '((eval . (list (concat "^\\(?:" outline-regexp "\\).*") 0 '(outline-font-lock-face) t t))) "Additional expressions to highlight in Orgstruct Mode and Outline minor mode. The difference to `outline-font-lock-keywords' is that this will overwrite other highlighting.") (defun th-outline-regexp () "Calculate the outline regexp for the current mode." (let ((comment-starter (replace-regexp-in-string "[[:space:]]+" "" comment-start))) (when (string= comment-starter ";") (setq comment-starter ";;")) (concat comment-starter "[*]+ "))) (defun th-outline-minor-mode-init () (interactive) (setq outline-regexp (th-outline-regexp)) (font-lock-add-keywords nil th-outline-minor-mode-font-lock-keywords)) (add-hook 'outline-minor-mode-hook 'th-outline-minor-mode-init) (defvar th-outline-minor-mode-modes '(c-mode emacs-lisp-mode lisp-mode ruby-mode haskell-mode lua-mode clojure-mode sh-mode)) (defun th-turn-on-outline-minor-mode () (interactive) (outline-minor-mode 1)) (dolist (mode th-outline-minor-mode-modes) (add-hook (intern (concat (symbol-name mode) "-hook")) 'th-turn-on-outline-minor-mode)) --8<---------------cut here---------------end--------------->8--- Basically, it calculates the `outline-regexp' for a mode by concatenating the `comment-starter' with one or more *, and all lines starting with that should be highlighted with `outline-font-lock-face'. To reproduce the problem, put the code in *scratch* and eval it. Then find some shell script, and you'll see that no highlighting is done. It is important to also evaluate the three last forms, which put the outline-minor-mode activation inside the mode-hooks. If I omit these lines, open a shell script and then activate `outline-minor-mode' manually, font-locking works normal... Am I doing anything wrong? Bye, Tassilo