GNU bug report logs - #3061
octave end keyword bug

Previous Next

Package: emacs;

Reported by: "Daniel Elliott" <danelliottster <at> gmail.com>

Date: Sat, 22 Nov 2008 00:05:06 UTC

Severity: normal

Merged with 1407

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 3061 in the body.
You can then email your comments to 3061 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report stored:
bug#1407; Package emacs,octave. Full text and rfc822 format available.

Message #3 received at quiet <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Daniel Elliott" <danelliottster <at> gmail.com>
To: quiet <at> debbugs.gnu.org
Subject: end keyword bug
Date: Fri, 26 Oct 2007 02:35:06 +0000
Package: emacs,octave

[ resent from
  http://lists.gnu.org/archive/html/bug-gnu-emacs/2007-10/msg00166.html ]

Hello,

Thank you for your work on the emacs octave-mode!

Has the incorrect indentation when the end keyword is used as an array
index been fixed?  Currently, any use of end other than to close a
loop or conditional block confuses the indentation of octave-mode.

Example:

for c=1:C
    Lambda(lastGood_Lambda(c)+1:end,c) = sigma;D_c(c) = M;
  endfor

The octave-mode thinks that the end used as an array index is the end
for the for loop.

If this has been fixed, where should I download the latest, fixed,
stable version?

Thank you,

dan elliott




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, Octave Bugs <bug <at> octave.org>:
bug#1407; Package emacs,octave. Full text and rfc822 format available.

Acknowledgement sent to "Juanma Barranquero" <lekktu <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, Octave Bugs <bug <at> octave.org>. Full text and rfc822 format available.

Message #8 received at 1407 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Juanma Barranquero" <lekktu <at> gmail.com>
To: "Daniel Elliott" <danelliottster <at> gmail.com>
Cc: 1407 <at> debbugs.gnu.org
Subject: Re: end keyword bug
Date: Sun, 23 Nov 2008 23:31:22 +0100
On Fri, Oct 26, 2007 at 03:35, Daniel Elliott <danelliottster <at> gmail.com> wrote:

> Example:
>
> for c=1:C
>    Lambda(lastGood_Lambda(c)+1:end,c) = sigma;D_c(c) = M;
>  endfor
>
> The octave-mode thinks that the end used as an array index is the end
> for the for loop.

Does this problem still happen with the latest Emacs code from the
CVS? Apparently it was fixed some time ago.

  Juanma




Reply sent to Glenn Morris <rgm <at> gnu.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to "Daniel Elliott" <danelliottster <at> gmail.com>:
bug acknowledged by developer. Full text and rfc822 format available.

Message #13 received at 1407-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Juanma Barranquero <lekktu <at> gmail.com>
Cc: 1407-done <at> debbugs.gnu.org
Subject: Re: bug#1407: end keyword bug
Date: Mon, 24 Nov 2008 02:45:00 -0500
"Juanma Barranquero" wrote:

> Does this problem still happen with the latest Emacs code from the
> CVS? Apparently it was fixed some time ago.

My mistake; I forwarded what I thought was an old unanswered bug, but
you are right, it is fixed. (I was thinking it was about font-lock
rather than indentation.)




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, Octave Bugs <bug <at> octave.org>:
bug#1407; Package emacs,octave. Full text and rfc822 format available.

Acknowledgement sent to "Daniel Elliott" <danelliottster <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>, Octave Bugs <bug <at> octave.org>. Full text and rfc822 format available.

Message #18 received at 1407 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Daniel Elliott" <danelliottster <at> gmail.com>
To: 1407 <at> debbugs.gnu.org
Subject: Re: bug#1407 closed by Glenn Morris <rgm <at> gnu.org> (Re: bug#1407: end keyword bug)
Date: Wed, 10 Dec 2008 10:12:34 -0600
I would say that this is definately not fixed.  Now the octave mode no
longer considers end to be a valid keyword to end blocks like if,
while, for, etc.  Octave mode should allow end to close these things
in the same way that it uses endif, endwhile, and endfor respectively.

Thanks.

- dan

On Mon, Nov 24, 2008 at 1:55 AM, Emacs bug Tracking System
<don <at> donarmstrong.com> wrote:
>
> This is an automatic notification regarding your bug report
> which was filed against the emacs,octave package:
>
> #1407: end keyword bug
>
> It has been closed by Glenn Morris <rgm <at> gnu.org>.
>
> Their explanation is attached below along with your original report.
> If this explanation is unsatisfactory and you have not received a
> better one in a separate message then please contact Glenn Morris <rgm <at> gnu.org> by
> replying to this email.
>
>
> --
> 1407: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=1407
> Emacs Bug Tracking System
> Contact don <at> donarmstrong.com with problems
>
>
> ---------- Forwarded message ----------
> From: Glenn Morris <rgm <at> gnu.org>
> To: Juanma Barranquero <lekktu <at> gmail.com>
> Date: Mon, 24 Nov 2008 02:45:00 -0500
> Subject: Re: bug#1407: end keyword bug
> "Juanma Barranquero" wrote:
>
>> Does this problem still happen with the latest Emacs code from the
>> CVS? Apparently it was fixed some time ago.
>
> My mistake; I forwarded what I thought was an old unanswered bug, but
> you are right, it is fixed. (I was thinking it was about font-lock
> rather than indentation.)
>
>
>
> ---------- Forwarded message ----------
> From: "Daniel Elliott" <danelliottster <at> gmail.com>
> To: quiet <at> emacsbugs.donarmstrong.com
> Date: Fri, 26 Oct 2007 02:35:06 +0000
> Subject: end keyword bug
> Package: emacs,octave
>
> [ resent from
>  http://lists.gnu.org/archive/html/bug-gnu-emacs/2007-10/msg00166.html ]
>
> Hello,
>
> Thank you for your work on the emacs octave-mode!
>
> Has the incorrect indentation when the end keyword is used as an array
> index been fixed?  Currently, any use of end other than to close a
> loop or conditional block confuses the indentation of octave-mode.
>
> Example:
>
> for c=1:C
>    Lambda(lastGood_Lambda(c)+1:end,c) = sigma;D_c(c) = M;
>  endfor
>
> The octave-mode thinks that the end used as an array index is the end
> for the for loop.
>
> If this has been fixed, where should I download the latest, fixed,
> stable version?
>
> Thank you,
>
> dan elliott
>
>
>
>




bug reopened, originator not changed. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Wed, 10 Dec 2008 18:45:03 GMT) Full text and rfc822 format available.

Information stored :
bug#1407; Package emacs,octave. (Wed, 17 Dec 2008 18:45:04 GMT) Full text and rfc822 format available.

Message #23 received at 1407-quiet <at> emacsbugs.donarmstrong.com (full text, mbox):

From: dan <danelliottster <at> gmail.com>
To: 1407-quiet <at> debbugs.gnu.org
Subject: Re: bug#1407: end keyword bug
Date: Tue, 16 Dec 2008 14:10:03 -0800 (PST)
Hello.

Here is my suggested fix for this problem.  It has the negative aspect
of identifying all end keywords between parens as not block-ending
keywords.  However, I doubt that is a problem.

I've used this for a couple days and everything seems fine.  I'm also
not certain if we can add end as a valid keyword for things in the
octave-block-match-alist.

- dan elliott

--- octave-mod.bak.el   2008-12-16 14:35:14.000000000 -0700
+++ octave-mod.el       2008-12-16 14:45:53.000000000 -0700
@@ -101,11 +101,9 @@
   '("do" "for" "function" "if" "switch" "try" "unwind_protect"
"while"))
 (defvar octave-else-keywords
   '("case" "catch" "else" "elseif" "otherwise"
"unwind_protect_cleanup"))
-;; FIXME: only use specific "end" tokens here to avoid confusion when
"end"
-;; is used in indexing (the real fix is much more complex).
 (defvar octave-end-keywords
   '("endfor" "endfunction" "endif" "endswitch" "end_try_catch"
-    "end_unwind_protect" "endwhile" "until"))
+    "end_unwind_protect" "endwhile" "until" "end"))

 (defvar octave-reserved-words
   (append octave-begin-keywords
@@ -346,13 +344,13 @@
 ;; is used in indexing (the real fix is much more complex).
 (defvar octave-block-match-alist
   '(("do" . ("until"))
-    ("for" . ("endfor"))
+    ("for" . ("endfor" "end"))
     ("function" . ("endfunction"))
-    ("if" . ("else" "elseif" "endif"))
-    ("switch" . ("case" "otherwise" "endswitch"))
+    ("if" . ("else" "elseif" "endif" "end"))
+    ("switch" . ("case" "otherwise" "endswitch" "end"))
     ("try" . ("catch" "end_try_catch"))
     ("unwind_protect" . ("unwind_protect_cleanup"
"end_unwind_protect"))
-    ("while" . ("endwhile")))
+    ("while" . ("endwhile" "end")))
   "Alist with Octave's matching block keywords.
 Has Octave's begin keywords as keys and a list of the matching else
or
 end keywords as associated values.")
@@ -680,7 +678,8 @@
                        (if (= bot (point))
                            (setq icol (+ icol octave-block-offset))))
                       ((octave-looking-at-kw octave-block-end-regexp)
-                       (if (not (= bot (point)))
+                       (if (and (not (= bot (point)))
+                                (not (octave-end-as-array-index-
p))) ;special case for end keyword but is applied to all keywords
                            (setq icol (- icol
                                          (octave-block-end-
offset)))))))
                  (forward-char)))
@@ -1525,3 +1524,14 @@

 ;; arch-tag: 05f1ce09-be87-4c00-803e-4919ffa26c23
 ;;; octave-mod.el ends here
+
+
+;; TODO: this should probably also make sure we are actually looking
at and "end" keyword
+(defun octave-end-as-array-index-p ()
+  "pos is the position of the end keyword (end 'e', 'n', or 'd')"
+  (save-excursion
+    (condition-case nil                        ;test if point is
between parens
+       (progn
+         (up-list 1)
+         t)
+      (error nil))))

On Dec 10, 10:12 am, "Daniel Elliott" <danelliotts...@gmail.com>
wrote:
> I would say that this is definately not fixed.  Now the octave mode no
> longer considers end to be a valid keyword to end blocks like if,
> while, for, etc.  Octave mode should allow end to close these things
> in the same way that it uses endif, endwhile, and endfor respectively.
>
> Thanks.
>
> - dan
>
> On Mon, Nov 24, 2008 at 1:55 AM, Emacs bug Tracking System
>
> <d...@donarmstrong.com> wrote:
>
> > This is an automatic notification regarding your bug report
> > which was filed against the emacs,octave package:
>
> > #1407: end keyword bug
>
> > It has been closed by Glenn Morris <r...@gnu.org>.
>
> > Their explanation is attached below along with your original report.
> > If this explanation is unsatisfactory and you have not received a
> > better one in a separate message then please contact Glenn Morris <r...@gnu.org> by
> > replying to this email.
>
> > --
> > 1407:http://debbugs.gnu.org/cgi/bugreport.cgi?bug=1407
> > Emacs Bug Tracking System
> > Contact d...@donarmstrong.com with problems
>
> > ---------- Forwarded message ----------
> > From: Glenn Morris <r...@gnu.org>
> > To: Juanma Barranquero <lek...@gmail.com>
> > Date: Mon, 24 Nov 2008 02:45:00 -0500
> > Subject: Re: bug#1407: end keyword bug
> > "Juanma Barranquero" wrote:
>
> >> Does this problem still happen with the latest Emacs code from the
> >> CVS? Apparently it was fixed some time ago.
>
> > My mistake; I forwarded what I thought was an old unanswered bug, but
> > you are right, it is fixed. (I was thinking it was about font-lock
> > rather than indentation.)
>
> > ---------- Forwarded message ----------
> > From: "Daniel Elliott" <danelliotts...@gmail.com>
> > To: qu...@emacsbugs.donarmstrong.com
> > Date: Fri, 26 Oct 2007 02:35:06 +0000
> > Subject: end keyword bug
> > Package: emacs,octave
>
> > [ resent from
> >  http://lists.gnu.org/archive/html/bug-gnu-emacs/2007-10/msg00166.html]
>
> > Hello,
>
> > Thank you for your work on the emacs octave-mode!
>
> > Has the incorrect indentation when the end keyword is used as an array
> > index been fixed?  Currently, any use of end other than to close a
> > loop or conditional block confuses the indentation of octave-mode.
>
> > Example:
>
> > for c=1:C
> >    Lambda(lastGood_Lambda(c)+1:end,c) = sigma;D_c(c) = M;
> >  endfor
>
> > The octave-mode thinks that the end used as an array index is the end
> > for the for loop.
>
> > If this has been fixed, where should I download the latest, fixed,
> > stable version?
>
> > Thank you,
>
> > dan elliott




bug reopened, originator not changed. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Sun, 19 Apr 2009 19:20:02 GMT) Full text and rfc822 format available.

bug 1407 cloned as bug 3061. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Mon, 20 Apr 2009 21:30:06 GMT) Full text and rfc822 format available.

bug reopened, originator not changed. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> emacsbugs.donarmstrong.com. (Mon, 20 Apr 2009 21:30:06 GMT) Full text and rfc822 format available.

Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>, Octave Bugs <bug <at> octave.org>:
bug#3061; Package emacs,octave. (Tue, 21 Apr 2009 07:15:04 GMT) Full text and rfc822 format available.

Message #32 received at 3061 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: danelliottster <at> gmail.com
Cc: 3061 <at> debbugs.gnu.org
Subject: octave end keyword bug
Date: Tue, 21 Apr 2009 03:08:37 -0400
I am sorry that your Emacs bug #1407 has been invaded by spammers who
keep closing it. Unfortunately, I can't prevent this, but I have
created a fresh copy as bug #3061, which hopefully they will not figure
out how to close.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#3061; Package emacs,octave. (Sat, 02 Jan 2010 19:43:02 GMT) Full text and rfc822 format available.

Message #35 received at 3061 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: dan <danelliottster <at> gmail.com>
Cc: 3061 <at> debbugs.gnu.org
Subject: Re: bug#1407: end keyword bug
Date: Sat, 02 Jan 2010 14:42:31 -0500
> Here is my suggested fix for this problem.  It has the negative aspect
> of identifying all end keywords between parens as not block-ending
> keywords.  However, I doubt that is a problem.
>
> I've used this for a couple days and everything seems fine.  I'm also
> not certain if we can add end as a valid keyword for things in the
> octave-block-match-alist.

Hi,

Sorry for the long delay, but I've just checked your patch into the
Emacs repository; it will be included in the upcoming Emacs 23.2
release.  Thanks, and let us know if you have any further problems with
Octave mode.




bug closed, send any further explanations to "Daniel Elliott" <danelliottster <at> gmail.com> Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> debbugs.gnu.org. (Sat, 02 Jan 2010 19:43:03 GMT) Full text and rfc822 format available.

Merged 1407 3061. Request was from Glenn Morris <rgm <at> gnu.org> to control <at> debbugs.gnu.org. (Wed, 13 Jan 2010 18:58:03 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <bug-gnu-emacs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 11 Feb 2010 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 15 years and 72 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.