unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* octave-mode/SMIE question
@ 2014-06-04 21:52 Eduard Wiebe
  2014-06-05  0:33 ` Leo Liu
  2014-06-05  0:43 ` Stefan Monnier
  0 siblings, 2 replies; 4+ messages in thread
From: Eduard Wiebe @ 2014-06-04 21:52 UTC (permalink / raw)
  To: emacs-devel


 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?

--
Eduard Wiebe




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: octave-mode/SMIE question
  2014-06-04 21:52 octave-mode/SMIE question Eduard Wiebe
@ 2014-06-05  0:33 ` Leo Liu
  2014-06-05  0:43 ` Stefan Monnier
  1 sibling, 0 replies; 4+ messages in thread
From: Leo Liu @ 2014-06-05  0:33 UTC (permalink / raw)
  To: emacs-devel

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




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: octave-mode/SMIE question
  2014-06-04 21:52 octave-mode/SMIE question Eduard Wiebe
  2014-06-05  0:33 ` Leo Liu
@ 2014-06-05  0:43 ` Stefan Monnier
  2014-06-05 19:28   ` Eduard Wiebe
  1 sibling, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2014-06-05  0:43 UTC (permalink / raw)
  To: Eduard Wiebe; +Cc: emacs-devel

> How i can accomplish the intended behaviour of `smie-close-block' for
> my matlab-mode?

You'll want to tweak smie-closer-alist.


        Stefan



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: octave-mode/SMIE question
  2014-06-05  0:43 ` Stefan Monnier
@ 2014-06-05 19:28   ` Eduard Wiebe
  0 siblings, 0 replies; 4+ messages in thread
From: Eduard Wiebe @ 2014-06-05 19:28 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> How i can accomplish the intended behaviour of `smie-close-block' for
>> my matlab-mode?
>
> You'll want to tweak smie-closer-alist.

m(

Stefan, thanks for the hint.

-- 
Eduard Wiebe




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-06-05 19:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-04 21:52 octave-mode/SMIE question Eduard Wiebe
2014-06-05  0:33 ` Leo Liu
2014-06-05  0:43 ` Stefan Monnier
2014-06-05 19:28   ` Eduard Wiebe

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).