From: lee <lee@yun.yagibdah.de>
To: help-gnu-emacs@gnu.org
Subject: Re: `comment-start' is nil
Date: Sat, 15 Mar 2014 21:50:16 +0100 [thread overview]
Message-ID: <87iorfuqyf.fsf@yun.yagibdah.de> (raw)
In-Reply-To: <CAAeL0SStG-3Ma4LmrSYOJs7rSK2MxYiicpuMyeTkb5Q4g-Xgnw@mail.gmail.com> (Juanma Barranquero's message of "Wed, 12 Mar 2014 22:56:25 +0100")
Juanma Barranquero <lekktu@gmail.com> writes:
> On Wed, Mar 12, 2014 at 10:37 PM, lee <lee@yun.yagibdah.de> wrote:
>
>> I´m using desktop-mode to restore the previous session when starting
>> emacs. For some buffers that are restored this way, I´m using a mode
>> I´m 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´t
>> 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.
--
Knowledge is volatile and fluid. Software is power.
next prev parent reply other threads:[~2014-03-15 20:50 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-12 21:37 `comment-start' is nil lee
2014-03-12 21:56 ` Juanma Barranquero
2014-03-15 20:50 ` lee [this message]
2014-03-12 22:26 ` Thorsten Jolitz
2014-03-13 6:36 ` Michael Heerdegen
2014-03-15 21:01 ` lee
2014-03-16 17:18 ` Stefan
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87iorfuqyf.fsf@yun.yagibdah.de \
--to=lee@yun.yagibdah.de \
--cc=help-gnu-emacs@gnu.org \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.