From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: lee Newsgroups: gmane.emacs.help Subject: Re: `comment-start' is nil Date: Sat, 15 Mar 2014 21:50:16 +0100 Organization: my virtual residence Message-ID: <87iorfuqyf.fsf@yun.yagibdah.de> References: <878usf6qu5.fsf@yun.yagibdah.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1394918156 25778 80.91.229.3 (15 Mar 2014 21:15:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 15 Mar 2014 21:15:56 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Mar 15 22:16:06 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WOvw2-0004x1-Or for geh-help-gnu-emacs@m.gmane.org; Sat, 15 Mar 2014 22:16:02 +0100 Original-Received: from localhost ([::1]:51216 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOvw2-0008JJ-3p for geh-help-gnu-emacs@m.gmane.org; Sat, 15 Mar 2014 17:16:02 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOvum-0006JJ-N3 for help-gnu-emacs@gnu.org; Sat, 15 Mar 2014 17:14:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WOvud-0002l5-WC for help-gnu-emacs@gnu.org; Sat, 15 Mar 2014 17:14:44 -0400 Original-Received: from client-194-42-186-216.muenet.net ([194.42.186.216]:36526 helo=yun.yagibdah.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOvud-0002jf-Lg for help-gnu-emacs@gnu.org; Sat, 15 Mar 2014 17:14:35 -0400 Original-Received: from lee by yun.yagibdah.de with local (Exim 4.80.1) (envelope-from ) id 1WOvuT-0005kG-RE for help-gnu-emacs@gnu.org; Sat, 15 Mar 2014 22:14:25 +0100 In-Reply-To: (Juanma Barranquero's message of "Wed, 12 Mar 2014 22:56:25 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Mail-Followup-To: help-gnu-emacs@gnu.org X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 194.42.186.216 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:96523 Archived-At: Juanma Barranquero writes: > On Wed, Mar 12, 2014 at 10:37 PM, lee wrote: > >> I=C2=B4m using desktop-mode to restore the previous session when starting >> emacs. For some buffers that are restored this way, I=C2=B4m using a mo= de >> I=C2=B4m working on. This mode employs a function to search for a regex= in >> particular buffers. The regex involves `comment-start'. >> >> Unfortunately, at the time the function is running during start-up, the >> value of `comment-start' is nil. >> >> >> (let ((end-marker (concat "^" comment-start lsl-hi-lock-patterns-end= -marker))) >> (message "comment-start with %s is %s" >> (buffer-name) >> comment-start) ...) >> >> >> gives me messages like "comment-start with test-plane.fontify is nil". >> Calling the same function later works fine because `comment-start' isn= =C2=B4t >> nil anymore. > > We'll need more information. It is a major mode or a minor mode? (define-derived-mode lsl-mode c++-mode "LSL" ... I`m not sure if it`s major or minor. The docstring says it`s major, but I didn`t write that part of it. > If a minor, which major mode are these buffers? Hm, I think it`s a major mode; "LSL" shows up first in the mode line. > How it is your function run during the startup? Please see https://github.com/Ratany/lsl-repo/tree/master/emacs --- I just pushed the latest version, it`s work in progress. `lsl-mode-apply-hi-lock-patterns' (in lsl-mode.el) is called when the mode is enabled. It uses the variable lsl-hi-lock-patterns-file to figure out from which file to read highlighting patterns. lsl-hi-lock-patterns-file should be set from the '-*-' line in the buffer. By the time the mode is enabled during startup, this variable is not set. I have a work-around in place so my code reads the variable from the '-*-' when it`s not set. > How does the function get the buffer to run into? (unless (assoc-default "\\.lsl$" auto-mode-alist) (add-to-list 'auto-mode-alist '("\\.lsl$" . lsl-mode)))) ... in `lsl-mode-auto-enable'. Desktop-mode seems to play into this in that it apparently remembers the modes of a buffer and re-enables them when restoring the buffers. --=20 Knowledge is volatile and fluid. Software is power.