emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: octave-mode/SMIE question


From: Leo Liu
Subject: Re: octave-mode/SMIE question
Date: Thu, 05 Jun 2014 08:33:36 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (CentOS 6.5)

On 2014-06-04 23:52 +0200, Eduard Wiebe wrote:
>  Hello,
>
> i have a question about `octave-mode' and/or SMIE.
>
> Consider the following snippet:
>
> (define-derived-mode matlab-mode octave-mode "MATLAB"
>   "My poor man's MATLAB mode based on `octave-mode'.
> \\{matlab-mode-map}"
>   (setq-local octave-end-keywords '("end")) ;; Without an effect
>   (setq-local octave-comment-char ?\%)
>   (setq-local octave-comment-start "%")
>   (setq-local octave-block-offset 4)
>   (setq-local octave-block-comment-start "%% "))
>
> If matlab-mode is loaded and i use `smie-close-block' (C-c /), then
> each block is closed with Octave-specific close token ('if' is closed
> with 'endif', 'while' with 'endwhile' and so on).
>
> But MATLAB-grammar knows only `end' as a block close token.
>
> How i can accomplish the intended behaviour of `smie-close-block' for
> my matlab-mode? Or is an advice my last chace?

Octave isn't aware of matlab's syntax. Last time I checked with octave's
mailing list, they didn't seem to like matlab's support in octave mode
anyway.

BTW, [UNTESTED] if you change octave-smie-bnf-table so that, for example:

         ("while" exp "end")
         ("while" exp "endwhile")

smie-close-block would pick "end" before "endwhile".

HTH,
Leo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]