From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Rosen Diankov" Newsgroups: gmane.comp.gnu.octave.general,gmane.emacs.bugs Subject: Re: Octave comments in emacs Date: Tue, 12 Aug 2008 16:07:42 -0400 Message-ID: <103101d70808121307p61e728fbtc5aed8b91bf25caf@mail.gmail.com> References: <103101d70808111936u419212e8m8541f5f55ed00e3a@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1218572569 30496 80.91.229.12 (12 Aug 2008 20:22:49 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 12 Aug 2008 20:22:49 +0000 (UTC) Cc: bug-gnu-emacs@gnu.org, help@octave.org To: "Olivier Lefevre" Original-X-From: help-octave-bounces@octave.org Tue Aug 12 22:23:41 2008 Return-path: Envelope-to: gcgog-help-octave@gmane.org Original-Received: from mail.cae.wisc.edu ([144.92.13.31]) by lo.gmane.org with esmtp (Exim 4.50) id 1KT0P5-0004Wd-CL for gcgog-help-octave@gmane.org; Tue, 12 Aug 2008 22:23:39 +0200 Original-Received: from www.cae.wisc.edu (www-old.cae.wisc.edu [144.92.13.228]) by mail.cae.wisc.edu (8.13.8+Sun/8.13.3) with ESMTP id m7CKF10k004295; Tue, 12 Aug 2008 15:15:27 -0500 (CDT) Original-Received: from mail.cae.wisc.edu (mail.cae.wisc.edu [144.92.13.31]) by www.cae.wisc.edu (8.13.8+Sun/8.13.7) with ESMTP id m7CKEf0F016402 for ; Tue, 12 Aug 2008 15:14:41 -0500 (CDT) Original-Received: from mx3.cae.wisc.edu (mx3.cae.wisc.edu [144.92.12.134]) by mail.cae.wisc.edu (8.13.8+Sun/8.13.3) with ESMTP id m7CKEfEY004194 for ; Tue, 12 Aug 2008 15:14:41 -0500 (CDT) Original-Received: from rv-out-0708.google.com (rv-out-0708.google.com [209.85.198.246]) by mx3.cae.wisc.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m7CKEcV3012940 for ; Tue, 12 Aug 2008 15:14:40 -0500 Original-Received: by rv-out-0708.google.com with SMTP id c5so2373764rvf.24 for ; Tue, 12 Aug 2008 13:14:37 -0700 (PDT) Original-Received: by 10.140.134.15 with SMTP id h15mr4686911rvd.65.1218571662784; Tue, 12 Aug 2008 13:07:42 -0700 (PDT) Original-Received: by 10.141.107.12 with HTTP; Tue, 12 Aug 2008 13:07:42 -0700 (PDT) Original-Sender: ffxvzero@gmail.com In-Reply-To: <103101d70808111936u419212e8m8541f5f55ed00e3a@mail.gmail.com> Content-Disposition: inline X-Google-Sender-Auth: 862c22e0700df642 X-Seen-By: Mailfromd 3.1.3 X-Virus-Scanned: by amavisd-new X-Spam-Flag: NO X-Spam-Level: X-Spam-Reason: BAYES_00, SARE_FROM_BADAOL X-BeenThere: help-octave@octave.org X-Mailman-Version: 2.1.7 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-octave-bounces@octave.org Xref: news.gmane.org gmane.comp.gnu.octave.general:21025 gmane.emacs.bugs:19347 Archived-At: 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 : > 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 : >> 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 >> >