unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Rosen Diankov" <rdiankov@cs.cmu.edu>
To: "Olivier Lefevre" <lefevrol@yahoo.com>
Cc: bug-gnu-emacs@gnu.org, help@octave.org
Subject: Re: Octave comments in emacs
Date: Tue, 12 Aug 2008 16:07:42 -0400	[thread overview]
Message-ID: <103101d70808121307p61e728fbtc5aed8b91bf25caf@mail.gmail.com> (raw)
In-Reply-To: <103101d70808111936u419212e8m8541f5f55ed00e3a@mail.gmail.com>

Small corrections:

In calculate-octave-indent, just delete the entire expression

((looking-at "\\s<\\S<")
       (setq icol (list comment-column icol)))

that forces comments to comment-column (which is 32). Was there a
reason for this?

Also, it should be noted that forcing single quotes to act like double
quotes in the syntax table really messes up the transposing of
matrices with the ' operator. If you care more about using single
quotes in your scripts (because of matlab compatibility), then just
use the transpose function instead of '

Is there a way to assign two different syntax rules for the same
character in emacs? Ie, one where ' is treated as a string quote (and
suppresses the syntax elements inside the quotes), and one where it is
treated as a suffix operator.

rosen,

2008/8/11 Rosen Diankov <rdiankov@cs.cmu.edu>:
> The % also messes up formatting when seen in strings, ie 'my value: %d'
>
> For some reason, the octave syntax does not recognize that single
> quotes are strings (it might be because the transpose character is
> also ' and it is hard to differentiate between a string and the
> transposing).
>
> In any case, writing the above example will treat the % as a comment.
> The indenting engine will skip the closing parenthesis )... resulting
> in all the rest of the indents looking like garbage.
>
> To fix the weird positioning of single % comments and the following
> problems, go tino octave-mod.el and
>
> in octave-mode-syntax-table change
> (modify-syntax-entry ?\' "." table)
> to
> (modify-syntax-entry ?\' "\"" table)
>
> in calculate-octave-indent at the bottom change
> ((looking-at "\\s<\\S<")
> to
> ((and (looking-at "\\s<\\S<") (not (looking-at "%")))
>
> i use (looking-at octave-comment-char) instead since some people use #
> for comments
>
>
> I'm not sure what the consequences of these changes are. From the
> testing I've done, emacs formatting is running more like how the
> matlab editor would format. Now if someone can fix the indentation
> problems with "end", we'll have perfect indenting.
>
> rosen diankov,
>
>
> 2007/12/28 Olivier Lefevre <lefevrol@yahoo.com>:
>> Ah OK. I had read about % vs. %% and %%% but it hadn't registered, perhaps
>> because it smelled perl-ish and thus went in one ear, out the other.
>> In the brain-damaged language(s) the other gentleman was referring to,
>> emacs will automatically indent the comment line according to its position
>>  in the code, without need for any of that %% or %%% flummery ;-) That is
>> both more natural and more practical, I think. But I can live with %%.
>>
>> Thanks again,
>>
>> -- O.L.
>>
>> _______________________________________________
>> Help-octave mailing list
>> Help-octave@octave.org
>> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>>
>

  reply	other threads:[~2008-08-12 20:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-12  2:36 Octave comments in emacs Rosen Diankov
2008-08-12 20:07 ` Rosen Diankov [this message]
2008-08-14 20:31   ` bug#703: " Stefan Monnier
2011-03-10  7:06 ` bug#697: " Glenn Morris

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=103101d70808121307p61e728fbtc5aed8b91bf25caf@mail.gmail.com \
    --to=rdiankov@cs.cmu.edu \
    --cc=bug-gnu-emacs@gnu.org \
    --cc=help@octave.org \
    --cc=lefevrol@yahoo.com \
    /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 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).